Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto Timer in VBA 1

Status
Not open for further replies.

ihaveaproblem

Programmer
Jul 4, 2003
14
GB
I need to create some code in VBA to automatically kick off another function twice daily. Can this be done in VBA as I connot find the timer object I have used in VB^ in the past?

Any ideas anyone?
 
Every Access form has a built-in timer - play around with the TimerInterval and TimerEnabled settings.

You could also use API-based timers within a module, source code for which is on virtually every VB site. Do watch out while debugging though, as you could crash big-time if you break execution while an API timer is running.
 
There are several way to do this. I would recommend making a .bat file to run a macro. Then schedule the file to run twice daily. This way you avoid having to have the file open all the time.

example of a .bat file(just a text file with the following in it and with the .bat instead it .txt extension)

contents:
"C:\Program Files\Microsoft Office\Office10\msaccess.exe" c:\yourfolder\yourdatabase.mdb /x nameofmacro /cmd username:password

You may not need a username or password so just leave it out.

Then go to control panels and "tasks" to schdule the .bat file you just made.

Hope this helps!

 
Is this the only way? I ran into the same issue that I want to be able to have the code execute on the 1st and the 10th of each month.

-Laughter works miracles.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top