I have designed a macro to automatically update some of my tables. This macro takes about 15 minutes to run. I was hoping it was possible to have this macro run an hour or so before I start work every day. Is this possible?
Thanks, everyone for your help in this matter. What fixed the problem was changing the TimeBox to a text box from a label box and changing the name of the text box to TimeNow.
Using the windows scheduler looks like it would make sense, but after trying to set it up I guess I don't have permission to set up a task, because, when I got to the task Scheduler and went to new the program does nothing.
I use the code to try and run my macro but all it does is tell me the time, why doesn't it activate the macro??
Private Sub Form_Timer()
Dim TimeNow As String
TimeNow = Str(Time)
TimeBox.SetFocus
TimeBox.Text = TimeNow
If TimeBox.Text = "3:00 PM" Then
DoCmd.RunMacro "AAADataRefreshMacro"
End If
Exit Sub
End Sub
I changed the text box format to Medium and now I'm getting the following error message: "Compile Error: Can't find project or library" and the debugger stop on Str(Time)
My database is on a server, would this cause the problem??
Private Sub Form_Timer()
Dim TimeNow As String
TimeNow = Str(Time)
TimeBox.SetFocus
TimeBox.Text = TimeNow
If TimeBox.Text = "3:00 PM" Then
DoCmd.RunMacro "AAADataRefreshMacro"
End If
Exit Sub
End Sub
I run many tasks using Task Scheduler and find it to be the simplest method. I usually create a DOS Batch file to open the MDB and run the macro. Typical batch file:
START MSACCESS.EXE <Full Path and filename of mdb> /xMACRONAME
I am having problem sheduling task that runs a macro on windows 2000.
I have tried doing it with batch file and also with using
/x command.
same commands work fine from dos or from run.
but by scheduling it from task scheduling or by at command it just hangs.
I am not using system account but admin account.
Same stuff works from another Nt box.
If I schedule it as interactive it works.
Private Sub Form_Timer()
Dim TimeNow As String
TimeNow = Str(Time)
TimeBox.SetFocus
TimeBox.Text = TimeNow
If TimeBox.Text = "8:25 AM" Then
DoCmd.RunMacro "RunTotalUpdates"
End If
Exit Sub
It works great to run the macro once. I would like to run the macro every hour. Anyone know how to do that?
Just set up a blank form. In design mode, select properties, then set the Timer Interval property to "3600000" (the timer setting is in milliseconds, so that's one hour, I think).
Under the "On Timer" event, put your code to run the macro (DoCmd.RunMacro "RunTotalUpdates". You don't have to check the time, or any of that stuff. Leave the form open, and your code will run once an hour.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.