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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scheduling a Macro to run at a specific time of the day

Status
Not open for further replies.

Fiat77

Programmer
Feb 4, 2005
63
US
I have a Macro which runs a function in my database. I needed some module or trigger to automatically call or run this macro every day Monday - Friday at 4:00 PM. How can I do that?
Thanks
 
Hello Fiat77!

What you'll want to do is create a VBScript that execute the macro, and then schedule the VBScript in Windows Scheduler.

Here is a sample script...
Code:
Dim objAccess
Const WindowNorm = 1, WindowMin = 2, WindowMax = 3

Set objAccess = CreateObject("Access.Application")
objAccess.OpenCurrentDatabase "C:\Test.mdb"
objAccess.DoCmd.RunMacro "macTest"
objAccess.Quit True

Good luck!

He who has knowledge spares his words, and a man of understanding is of a calm spirit. Even a fool is counted wise when he holds his peace; when he shuts his lips, he is considered perceptive. - King Solomon
 
You can also use Scheduled Tasks to run various Databases at certain times. Go to:programs,Accessories,System Tools, Scheduled Tasks.
Set a form OnOpen() DoCmd.RunMacro "Name"
DoCmd.Quit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top