Quertion: Hi
I am trying to pass a simple command line parameter to my Access Application. In my Shortcut I have written this:
“M:\\MyApp.MDB” /Cmd “Success!”
and in the actual application the first line of code displays what’s in the command line. ie:
msgbox Command(),vbInformation
———————————
All I am getting are blank lines.
Any Suggestions,
Many thanks
Ted
Hi!
There is a very simple explanation:
Your command is:
“M:\\MyApp.MDB” /Cmd “Success!”
So you call MyApp.mdb, which is associated with Access, so, as expected, access launches the MDB as expected, but in the file association process, it looses all the rest, thus your blank line.
The easiest is to enter the command like this:
“c:\\program files\\microsoft office\\office\\msaccess.exe” /cmd Success!
Or whereever you have msaccess.exe installed.
There is another solution, which implies messing the registry. Just post a follow up and I can start trying: I LOVE messing the registry.
Regards.
Fredix gave this follow-up answer on 1/25/2002:
Hi! Me again!
I couldn’t resist to try the registry trick.
1) Click start/run, type regedit, click ok
2) If you are not familiar with the registry or abused with the bourbon, just concentrate and make no mistake. There is no Undo command.
3) Open the HKEY_CLASSES_ROOT key and browse down until you find the .mdb key. Open it.
4) Depending on your version of Access, you have: Access.Application.9 for Access 2000 or Access.Application.8 for Access 97.
5) The previous step was only for your culture. There is nothing to do here, just check its here.
6) In Edit menu, click find. Enter Access.Application.8 (97) or Access.Application.9 (2000). Click Find Next
7) Open this found key and look for a key named ‘Command’. Its under Access.Application.8\shell\open\
On the right part of the screen, click on the red icon. The value looks like this
I:\\Program Files\\Microsoft Office 97\\Office\\MSACCESS.EXE /NOSTARTUP “%1″
9) Note that my theory is correct: There is only one parameter taken here. You should add two more: One for the /cmd, and one for the “success!”
10) Change the value so that it is:
I:\\Program Files\\Microsoft Office 97\\Office\\MSACCESS.EXE /NOSTARTUP “%1″ %2 %3
Note there is no ” with the %2 and the %3
11) Close your editing box and try your command: “M:\\MyApp.MDB” /Cmd “Success!”
12) Guess what is displayed in your message box?
You can do the same with Access.Application.9 if you have Access 2000.
I hope this makes sense to you.
Regards.
Random Posts