Others

Fix Microsoft Access Ignoring Command-Line Arguments When Another Database is Open

Camila MilosovichCamila Milosovich Oct 22, 2026 868 views

Question details

The user needs to resolve an issue where Microsoft Access fails to receive command-line arguments (the Command$ value is blank) when another database is already running.

How to Fix Microsoft Access Ignoring Command-Line Arguments When Another Database is Open
Product
Microsoft Access
Device & OS
not provided
Scenario
Opening a database using a shortcut with a command-line argument while a different Microsoft Access database is already active.
Observed behavior
The new Access instance opens, but the command-line argument is ignored and the Command$ value returns blank.
Before you start

Verify the exact file path to your Microsoft Access executable (MSACCESS.EXE), as this location varies depending on your installed Windows and Office versions.

Solution 1Recommended

Specify the Full Path to the Access Executable in the Shortcut

Explicitly defining the path to MSACCESS.EXE in your shortcut forces Windows to start the intended Access instance and pass the command-line parameters correctly, bypassing default file association issues.

When you rely purely on file associations (e.g., targeting the .accdb or .mdb file directly in the shortcut), Windows may attempt to use Dynamic Data Exchange (DDE) to communicate with the already open instance of Access. This can result in the command-line arguments being dropped.

To bypass this, you must construct the shortcut target to point directly to the MSACCESS.EXE application file, followed by the database file, and finally the command-line argument.

1
Open Shortcut Properties

Right-click on the database shortcut that is failing to pass the argument and select 'Properties' from the context menu.

2
Edit the Target Path

Navigate to the 'Shortcut' tab. In the 'Target' field, locate the current path (which likely just points to your database file).

3
Prepend the MSACCESS.EXE Path

Add the full path to the Access executable in quotation marks at the very beginning of the Target field. For example: "C:\Program Files\Microsoft Office\root\Office16\MSACCESS.EXE".

4
Append the Database and Arguments

Add a space after the executable path, then enclose your database path in quotation marks, followed by your command switch. The final target should look like this: "C:\Path\To\MSACCESS.EXE" "C:\Path\To\Database.accdb" /cmd "YourArgument".

5
Save the Changes

Click 'Apply' and then 'OK' to save your new shortcut configuration. Double-click the shortcut to verify that the argument is now passed successfully even if another database is open.

Specify the Full Path to the Access Executable in the Shortcut
Locating MSACCESS.EXE: If you cannot find MSACCESS.EXE, check common paths like 'C:\Program Files\Microsoft Office\' or 'C:\Program Files (x86)\Microsoft Office\'. You can also right-click an empty Access shortcut from your Start Menu and select 'Open file location' to find the exact path.
Free Microsoft Office alternative

Try WPS Office for Your Document, Spreadsheet, and Presentation Needs

While WPS Office does not include a database management tool like MS Access, it is a fantastic, lightweight, and free alternative for Microsoft Word, Excel, and PowerPoint. Experience high compatibility and a familiar interface without the hefty subscription fees.

  1. 1. Download WPS Office: Visit the official WPS website and click 'Download WPS Office Free' to get the installer.
  2. 2. Install the Software: Run the downloaded installer and follow the on-screen prompts to complete the lightweight installation process.
  3. 3. Open Your Documents: Launch WPS Office and seamlessly open your existing Word, Excel, or PowerPoint files with complete formatting retention.
Highly compatible with Microsoft Word (.docx), Excel (.xlsx), and PowerPoint (.pptx) formats.Familiar, intuitive user interface for a seamless migration from Microsoft Office.Lightweight software package that runs smoothly on most operating systems.Free to use with powerful built-in PDF editing and conversion capabilities.
QA img-9

Frequently Asked Questions

Why does Access drop my command-line arguments when using just the file association?

When you rely on Windows file associations (targeting the database file directly), Windows may use Dynamic Data Exchange (DDE) to send instructions to the existing instance of Access. During this DDE communication, custom command-line arguments passed via the /cmd switch are often ignored or passed as a blank value.

How do I retrieve the command-line argument within Microsoft Access using VBA?

You can retrieve the argument passed via the /cmd switch by using the Command or Command$ function within your VBA modules, forms, or macros. For example, assigning `Dim strArgs As String; strArgs = Command()` will capture the string passed from the shortcut.

Does this issue affect all versions of Microsoft Access?

Yes, this behavior is a longstanding architectural quirk across multiple versions of Microsoft Access. It happens when relying on default file associations while another instance is running. Specifying the executable path directly is the universally recommended workaround.