Hi, Chris.
You can't do this from the command line, unless you write an application or
script that does this for you, and then call *that* application or script
from the command line. And since you are seeking to automate something in
Access via a Macro, I suspect that you aren't inclined to go that convoluted
route.
I also suspect that you aren't really typing this command on a command line
in the DOS shell or the Windows Start -> Run command text box, either. I
suspect that you are using a Windows shortcut to run the command that opens
the Access database where you want the Macro to execute.
True?
If so, and you don't have Access security implemented, then an Access
shortcut, not a Windows shortcut, will solve the problem. The Access
shortcut will determine whether an instance of the database application is
already open and, if it is, then it will execute the Macro for you. If the
correct database application is not already open, then Microsoft Access will
launch, open the database file, then execute your Macro.
To create an Access Macro shortcut:
1.) Open the database that contains the Macro you want to execute.
2.) Open the database window to view the list of Macros.
3.) Right-click with your mouse on the Macro (the one that you wanted to
execute from the command line).
4.) On the pop-up menu, select "Create Shortcut..." and use the "Create
Shortcut" dialog window to save the shortcut to your desktop (the default)
or in some directory on your hard drive.
When you execute the shortcut by double-clicking on it, Access will execute
the Macro immediately if the correct database file is already open on your
computer, or else a new instance of Access will open your database file,
then execute your macro.
HTH.
Gunny
See
http://www.QBuilt.com for all your database needs.
See
http://www.Access.QBuilt.com for Microsoft Access tips.