Run code at speified time

chris_visible

Registered User.
Local time
Today, 18:09
Joined
Jan 17, 2002
Messages
24
I would like for some code that is behind a button in Access to be run automatically everyday at a certain time. Can any body help me?
Thanks
 
Put this code behind the On click event of the command button.

Dim strTimeOutStart As Variant

strTimeOutStart = #9:00:00 AM# 'Whatever time you choose

If Format(Now(), "medium time") = Format(strTimeOutStart, "medium time") Then
'Your code here'

End If
 
Thanks. This only works when a user clicks on the button at the specified time doesn’t it? I would like it to run automatically at the specified time.
Is this possible?
 
Put the above code and your code on a On Timer event procedure of the form's main properties. Set the timer to be 60000 (60 seconds). This will then check the code every 60 seconds (or whatever you choose) and when it equals your selected time it will run.
 

Users who are viewing this thread

Back
Top Bottom