getting parameters from the command line

  • Thread starter Thread starter everymn
  • Start date Start date
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
 
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.
 
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$
 
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)
 
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.
 
Back
Top