Command line arguments

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

I am hoping someone can give me some assistance in using
command line prompts in automating a form.

I have a couple of routines I would like to run at
different times during the night and I would like to use
the Task Scheduler to do this. I've looked at the Help
for the startup command-line options, and it's not very
clear in how to use them.

Just as a test, I created a form and the following sub

sub Form_Load()

msgbox Command()

end sub

Just to display the text of the command prompt. Then I
created a shortcut on my desktop and modified the target
property to be L:\CL.mdb /cmd Test and I've tried
different permutations like ;Test and Test/cmd but to no
avail. I figured if I could display the text, I could
assign it to a variable and then select the routines I
wished to run.

Please let me know what I'm doing wrong, and what else
will I have to do when using the Task Scheduler. Thanks
in advance.

Mark
 
Mark said:
I am hoping someone can give me some assistance in using
command line prompts in automating a form.

I have a couple of routines I would like to run at
different times during the night and I would like to use
the Task Scheduler to do this. I've looked at the Help
for the startup command-line options, and it's not very
clear in how to use them.

Just as a test, I created a form and the following sub

sub Form_Load()

msgbox Command()

end sub

Just to display the text of the command prompt. Then I
created a shortcut on my desktop and modified the target
property to be L:\CL.mdb /cmd Test and I've tried
different permutations like ;Test and Test/cmd but to no
avail. I figured if I could display the text, I could
assign it to a variable and then select the routines I
wished to run.

Please let me know what I'm doing wrong, and what else
will I have to do when using the Task Scheduler. Thanks
in advance.

To use command line arguments you must use a shortcut to the Access
executable, not a shortcut to an MDB file. The same shortcut can also
specify an MDB file to open, but the shortcut must be to the MSAccess.exe
file. Similar to...

"C:\Program Files\Microsoft Office\Office\MSAccess.EXE" /cmd TEST "Path to
MDB file"
 
Another way of accomplishing what you want is to create a shortcut directly
to the form. With the database window open, drag and drop the form from the
database window to your desktop (or wherever else you want it). Then
reference that shortcut in the Task Scheduler.

The property sheet for the shortcut doesn't give much information so I can't
say what it takes to manually create the shortcut.

After your routine runs,
DoCmd.Quit
will close the application.

JMR
 
Back
Top