Is it possible to run an access query from the scheduler? I need to
update a table in the middle of the night, and so I would like to set
up a job on a machine thats on all night so I dont have to manually do
it.
MGFoster - 31 Mar 2006 00:31 GMT
> Is it possible to run an access query from the scheduler? I need to
> update a table in the middle of the night, and so I would like to set
> up a job on a machine thats on all night so I dont have to manually do
> it.
An easy way is to create a shortcut to the query (just right-click the
query in the DB window & drag to the desktop). Then set up the
scheduler to run the shortcut. After the query runs Access will remain
open until you give a command to close it or someone manually closes it.
If you want more control you can set up a routine or macro in the Access
file. Use a batch file (.bat) w/ a command line like this (all one
line):
"c:\program files\microsoft office\office10\msaccess.exe"
"c:\MyDatabase.mdb" /x MyMacroName
exit
The command line switch /x means run the macro named after the switch.
To get a VBA routine to run use the /cmd option. Then you have to use
VBA's Command function to retrieve the cmd & run it. See the Access VBA
help topic "Command Function" for more info.

Signature
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
david epsom dot com dot au - 31 Mar 2006 01:48 GMT
Here is a vb script example using the Windows Scripting host:
dim dbe
dim db
set dbe = wscript.createobject("dao.dbengine.36")
set db = dbe.OpenDatabase("c:\dev9.mdb")
db.Execute "qryBAI_2232_Match_tmp_Cheque", 512 or 128
wscript.quit
(david)
> Is it possible to run an access query from the scheduler? I need to
> update a table in the middle of the night, and so I would like to set
> up a job on a machine thats on all night so I dont have to manually do
> it.