By command line, I assume you mean windows batch files?
Sure, you can create a blank text document. (you need to turn on display of
file extensions to do this).
Just put the following code in a text file
dim accessApp
msgbox "Click ok to run batch job",64
set accessApp = createObject("Access.Application")
accessApp.OpenCurrentDataBase("C:\Documents and Settings\Albert\My
Documents\MyDatabase\batchstuff.mdb")
accessApp.Run "TimeUpDate"
accessApp.Quit
set accessApp = nothing
msgbox "Job complete", 64
After you type in the above windows script simply save the above. Now,
rename the above to mybatch.vbs. Note how the file icon changes. If you
double click on this file, then the windows batch file will run. If you plan
to use the script in the scheduler, you would of course remove the msgbox in
the above. You can also use
wscript.Echo "about to run"
If you at the command prompt use
cscript mybatch.vbs
Then, all output goes the test console, and the script will NOT halt.
However, if you click on the script (mybatch.vbs in this example), then you
will get a dialog box.
If you use msgbox in place of wscript.Echo, then EVEN when you use cscript
(console script), the msgbox will appear.
Further, the above mdb file of course would NOT have any startup forms, or
startup stuff. Often, I just make a new mdb, and LINK the tables to the
required applications, and that way you don't have any problems with the
startup forms etc.
The above windows script would simply launch ms-access, and then run a
public sub called TimeUpDate. At this point, you can then use the scheduler
and place the vbs script in the windows scheduler.
You can even run the above in the dos window. Just type in
start mybatch.vbs (of course, whatever the name you used..along with
full path name etc. would be required).
If you don't want to actually write a windows script as a above, then you
can just make mdb file that runs your code when you start it (don't forget
that if you do this, your code in ms-access HAS TO EXIT the application (use
application.quit).
So, in place of the above script, you can from the windows dos prompt, just
type in
start myBatcth.mdb
The above example just launches a mdb file called mybatch. Of course either
a form set via the startup options, or a autoexec macro would then run, and
then quite.
So, I think the windows script is a bit more flexibly, as your script gets
to choose what subroutines gets called.
note that you can go
start hello.doc
The above would start word, and open the above document. So, start is as if
you clicked on the document, but is run from the command prompt.