Passing argument to mde

B

Bill

Can I, and if so how do I, pass an argument to a mde
application? When my mde Autoexec macro runs, it
includes a "Runcode". I would like to pass any arguments
included in the launching of the mde to the function named
in the "Runcode". For example, if such arguments were
supported like with forms, my Autoexec macro would
include "Runcode" MyFunction(Openargs).

Thanks,
Bill
 
A

Allen Browne

You can pass command line arguments to an MDE.
Use the Command() function to retrieve them.

You can also specify a macro to run in the command line switches.
 
B

Bill

Allen,
In my autoexec macro, I have only one statement and
that is to Runcode "ScrRes(Command())". Then in the
ScrRes function, I've coded:
Public Function ScrRes(CmdLine As Variant)
MsgBox "Command line = [" & CmdLine & "]"
..
..
bla bla bla
..
..

No matter what I've tried, the command line is null, or
at least a zero length string. I even tried a variation on
the statement above as:
MsgBox "Command line = [" & Command() & "]"

The launch invocation is:
"C:\GCC\TMS-Source V6.5.mdb" /CMD "C"
Which is coded in the desktop shortcut used to launch
the application.

What am I missing?

Thanks,
Bill
 
B

Bill

Allen,
Ah ah! When I invoked from "Start -> Run", the
/CMD "C" works fine. However, unless there's a
special syntax required from within the "Target
pane" of a shortcut, the command-line syntax
won't work. Any thoughts on that?

Bill
 
D

Douglas J. Steele

The shortcut must include the full path to the executable, not just the path
to the database:

"C:\Program Files\Microsoft Office\Office\MSAccess.exe" "C:\Program
Files\Microsoft Office\Office\Samples\Northwind.mdb" /cmd "c"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top