I was wondering if there is anything like Application.Ontime (in excel) where I can set my code to run at a specific time each evening?
Many thanks
Amanda
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » code to run at a specific time (Access 2000)
Access does not have the equivalent of Application.OnTime, but a form has an On Timer event and a Timer Interval property. If Timer Interval is > 0, the On Timer event will fire every (Timer Interval) milliseconds. So for example if you set Timer Interval to 3600000 the On Timer event will fire every hour (3,600,000 = 60 x 60 x 1,000), and if you set it to 86400000 it will fire once a day (86,400,000 = 24 x 60 x 60 x 1,000). You can call the code you want to run from the event procedure:
Private Sub Form_Timer()
Call MyCode
End Sub
where MyCode is the name of the procedure (or function) you want to run. A prerequisite is that the database remains open, and the form within the database too.
Alternatively, you can use a Scheduler Utility to open the database at a specific time, and let it run code automatically (through a startup form or an AutoExec macro).
Hans,
Many thanks for this. I was going to use the scheduler, but I don’t really want the code to run each time I need to access the database.
Therefore I will stick to the On Timer event and a timer interval. I want the code to run at about 5 am each morning. Rather than go into the office at this time (I’m not great in the mornings). I will get a form to open the form with the On timer event and set it at 5 am for 86400000 so that it will run from then on at 5 am.
Thanks for your help. As always much appreciated.
Amanda
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.
Notifications