Passing a command line argument into Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Found post 8/20/2005 from ofer and tried his solution. Also consulted on-line
docs, but still having no success passing a command line argument. Latest try
was this in a shortcut:

"G:\Access Projects\Scanning\Scanning.mdb" /cmdHOME OFFICE

Then I created a button on a form with click event:

Dim LocationID As String 'Also tried leaving it as a variant.
LocationID = Command()

MsgBox "LocationID is " & LocationID

Keeps coming up blank and I can't figure out what is wrong. Have tried
different uses of quotes in the short cut, but no luck. Help appreciated.

richard
 
If you want Access to read the command line, you *must* reference
msaccess.exe. The command line arguments are ignored if your shortcut
is just to the .mdb file. I've been there - it's very frustrating.

Try the format:

PathToAccessApp MDBfile /cmd ArgumentToPassIn

put each piece that may have spaces between double quotes:

"C:\Program Files\Microsoft Office\msaccess.exe" "G:\Access
Projects\Scanning\Scanning.mdb" /cmd "HOME OFFICE"
 
Thanks Kevin, I wouldn't have guessed. My problem now is to find
msaccess.exe. It is not in the C:\Program Files\Microsoft Office folder or
any sub folder so far as I could find. Any thoughts?
 
richardb said:
Thanks Kevin, I wouldn't have guessed. My problem now is to find
msaccess.exe. It is not in the C:\Program Files\Microsoft Office
folder or any sub folder so far as I could find. Any thoughts?

Usually it's at...

C:\Program Files\Microsoft Office\Office\MSAccess.exe
 
It was in Office11. Please ignore last post.

Kevin K. Sullivan said:
If you want Access to read the command line, you *must* reference
msaccess.exe. The command line arguments are ignored if your shortcut
is just to the .mdb file. I've been there - it's very frustrating.

Try the format:

PathToAccessApp MDBfile /cmd ArgumentToPassIn

put each piece that may have spaces between double quotes:

"C:\Program Files\Microsoft Office\msaccess.exe" "G:\Access
Projects\Scanning\Scanning.mdb" /cmd "HOME OFFICE"
 
Back
Top