getting parameters from the command line

E

everymn

Hi,
I'm wondering if it's possible to start access from the command line
and make my own switches for parameters that I need in a VB module?
I've been looking at the Command$ variable but there doesn't appear to
be anything there, so it appears that VBA doesn't know how Access was
was invoked. Is this possible?

Thanks
 
A

Allen Browne

You can start msaccess.exe with the /cmd switch, and pass in the value you
need.

If you need multiple values, pass them in as a delimited string, and use
Split() to parse them.
 
E

everymn

On Tue, 12 Dec 2006 02:01:13 +0900, "Allen Browne"

Hmm, trying this and still not getting anything back. Perhaps I'm
trying to access them wrong. In a VBA routine shouldn't I just be
able to do this to view the command string? There isn't anything at
all in Command$, not even the Access command.

msgbox Command$
 
D

Douglas J. Steele

When you created the shortcut that included the /cmd switch, did you include
the full path to msaccess.exe in the shortcut?

"C:\Program Files\Microsoft Office\Office\Msaccess.exe" "C:\Program
Files\Microsoft Office\Office\Samples\Northwind.mdb" /cmd "Orders"

/cmd is a switch for the executable, not for the mdb (or mde)
 
E

everymn

On Mon, 11 Dec 2006 15:05:53 -0500, "Douglas J. Steele"

Good call, thanks. For some reason, I thought putting it after the
mdb it might get passed to Access, but as you say, no.
 

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