By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,137 Members | 2,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,137 IT Pros & Developers. It's quick & easy.

run an Access query from windows scheduler

P: n/a
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.

Mar 30 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
sumGirl wrote:
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.


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBRCxqV4echKqOuFEgEQKkJQCfdx1SAcDp3PEyWVXpC1Kyn5 dtmqQAoMtF
1I2BkeawN4g4bVFmq5IOOd2o
=svAF
-----END PGP SIGNATURE-----
Mar 30 '06 #2

P: n/a
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)

"sumGirl" <ni*******@gmail.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
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.

Mar 31 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.