Automation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
Is it possible to have specific functions or code run at certain times of
the day? Is this something that can be set up, and if so, how?
Thank you!
-gary
 
Sure,

Every form has a timer event that you can use to check the current time.
You could then create a table with times and actions you want to perform. In
the timer event, you would check to see whether the time in your table falls
between now and your next timer event and then use an if or case stateement
to run a specific set of code based on the action in the table.

Dale
 
thank you! I will look into this!
-gary

Dale Fye said:
Sure,

Every form has a timer event that you can use to check the current time.
You could then create a table with times and actions you want to perform. In
the timer event, you would check to see whether the time in your table falls
between now and your next timer event and then use an if or case stateement
to run a specific set of code based on the action in the table.

Dale
 
If you create a form and set the Timer to something like 250 then in the
OnTimer event you put If format(now(),"hhmmss")=format(SomeTime,"hhmmss")
then
Call SomeFunction()
Else
End
The timer will cause this code to loop every 250 ms. The time timer count
can be anything you want. I would not make it too large or it may skip over
the time you are looking for
 
Be aware that your database has to be open for Timer code to run. Having
Timer code constantly running will be a hit on the performance of everything
you do in the database. Consider splitting your database if you haven't
already done that. Since you want to periodically run some code, the only
thing that code could be doing is some addition or modification to one or
more tables. Consider creating an external database to contain the code you
want to run. In that database, create an autoexec macro to start the code
when the database file is opened. Use Windows Taskmaster to open that
database at specified times you set in Taskmaster. You can also have code
that closes the file after your code is finished running. Doing it this way
you avoid needing to have any database open when it's time to run the code
(the externeal database is automatically opened at the specified time) and
you avoid any performance hit on your primary database.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
Back
Top