Automatically run code at given time.

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

I have a function that outputs a query to excel. I run
this code every day. Currently I have to hit a command
button to run the code. I am looking for a way to have
the database do this automatically at 5PM. The output
code is: DoCmd.OutputTo
acOutputQuery, "qryOpenPBConPriorityCountCrosstab",
acFormatXLS, "P:\Phil Hull\PBContractorOpenItemCount", -1
The database is on a server and I would like it to
automatically run this code at 5PM. I would appreciate
your help with the automation code.
Thanks, Mike
 
If you have a form open around 5pm, you can use the On
Timer event of the form. Set the Timer Interval to a
minute (60,000 milliseconds) and check if the Time() is
5:00 and if so, run the code.
 
Or,

Create a windows task opening the database using a command
argument. Then, on the open of the database, check the
command lines and if it says to run the query, do it.


Chris.
 
Back
Top