Command Line Arguments

  • Thread starter Thread starter Eric Dreksler
  • Start date Start date
E

Eric Dreksler

I'm not sure if this is the proper newsgroup for this (and if it isn't
please point me in the right direction).

I'm trying to pull the command line arguement (mydb.mdb /cmd cmdlnarg) upon
opening the mdb.

I've tried using the Command(), but apparently this doesn't work in Office
(accourding to the Office site).

Does anyone know what to do to pull the command line args, and if they have
to be passed in a different format.

Thanks In Advance,
Eric Dreksler
 
Hi Eric,

If I use this command line in Windows XP's Start|Run dialog

"C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE"
"C:\Temp\XXX.mdb" /cmd this is a /test

and after Access launches go to the VBE Immediate pane and type
?Command()
it returns
this is a /test

This is as documented in Help under "Command Function (Access)" and
"command line arguments"; it's a different function from the VB
Command() function. But things may be different in your version of
Access.
 
This doesn't seem to work in Access 2003 though (which is what I'm using).
I've tried the same thing youv'e done, but to no avail.

Thanks,
Eric
 
Hi Eric,

I've just tried this in Access 2003 under Windows XP SP1 and it seems to
work exactly as it does in Access 2002.

Create a new database (mdb file). In it create a macro containing
Action: MsgBox
Message: =Command()
Beep: Yes
Type: Information
Title: Command Line Arguments

Save the macro as
AutoExec
and close Access.

Then launch it with an appropriate command line, something like this
(all on one line, of course):

"C:\Program Files\Microsoft Office\Office11\MSACCESS.EXE"
"C:\XXX.mdb" /cmd ARG1 ARG2 ARG3

Does this work?



This doesn't seem to work in Access 2003 though (which is what I'm using).
I've tried the same thing youv'e done, but to no avail.

Thanks,
Eric
 
No dice, what I was doing originally was similar (just running a module on
startup that pulled the Command() function).

I get an error msg:
"The Expression you entered has a function name that Microsoft Access can't
find."

Then it pulls up the macro error box w/ '=Command()' as the Action Name.

Access 2003 (11.5614.5703)
WinXP (ver 2002) SP1

The only reason I'm so adament about this is that are Order and Provisioning
software is currently under development, and therefore we can't make any
direct links to the data to run reports on.
The developers allowed for us to make custom reports by having the app open
a shell w/ Access (shell CustomReport.mdb /cmd Filter = Value) or such to
allow for a reporting alternative.

Thanks,
Eric Dreksler


John Nurick said:
Hi Eric,

I've just tried this in Access 2003 under Windows XP SP1 and it seems to
work exactly as it does in Access 2002.

Create a new database (mdb file). In it create a macro containing
Action: MsgBox
Message: =Command()
Beep: Yes
Type: Information
Title: Command Line Arguments

Save the macro as
AutoExec
and close Access.

Then launch it with an appropriate command line, something like this
(all on one line, of course):

"C:\Program Files\Microsoft Office\Office11\MSACCESS.EXE"
"C:\XXX.mdb" /cmd ARG1 ARG2 ARG3

Does this work?
 
Possibly this is an order-of-references problem. Try (in immediate pane)
? Command$()
or disambiguate with
? VBA.Interaction.Command()



No dice, what I was doing originally was similar (just running a module on
startup that pulled the Command() function).

I get an error msg:
"The Expression you entered has a function name that Microsoft Access can't
find."

Then it pulls up the macro error box w/ '=Command()' as the Action Name.

Access 2003 (11.5614.5703)
WinXP (ver 2002) SP1

The only reason I'm so adament about this is that are Order and Provisioning
software is currently under development, and therefore we can't make any
direct links to the data to run reports on.
The developers allowed for us to make custom reports by having the app open
a shell w/ Access (shell CustomReport.mdb /cmd Filter = Value) or such to
allow for a reporting alternative.

Thanks,
Eric Dreksler
 
Well I seem to have got it working. I didn't try your last suggestion just
yet.
But I added the msgbox code to the load event of a blank form, and it worked
perfect. Even though the msgbox in the Macro still crashes out for some
strange reason.

Oh well, I'll just have to have a form start up w/ the db,run the code that
way, and shut itself down.

Seems like a strange problem, but as long as I've got a workaround I'm happy
for now.

Thanks again for all the help,
Eric Dreksler


John Nurick said:
Possibly this is an order-of-references problem. Try (in immediate pane)
? Command$()
or disambiguate with
? VBA.Interaction.Command()
 
Back
Top