Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / March 2006

Tip: Looking for answers? Try searching our database.

run an Access query from windows scheduler

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sumGirl - 30 Mar 2006 16:26 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.
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.