View Full Version : Pause?


Smudger
09-05-2005, 04:13 AM
Hi All,
I am trying to automate a macro to run every hour. Is there such thing as a "Pause" or "Wait" function. I am trying to do this in a macro as I am rubbish at VBA!!!

Any advice - Other than "Get on a VBA course!"

Cheers

Mark

allan57
09-05-2005, 05:55 AM
Public Function TimerDelaySecs(DelayInSecs As Integer)

Dim dteSetDelay As Date

dteSetDelay = DateAdd("S", DelayInSecs, Now())

While Now() < dteSetDelay

Wend

End Function

Smudger
09-05-2005, 07:24 AM
How do I put this into the database

As I said before - I am not good at this stuff ;o)

FoFa
09-06-2005, 08:51 AM
While that code will work, it will dang near tie up the PC it is running on. If that is an issue you can code a timer event on a form (you can keep it minimized) that fires every X seconds and when an hour is reached, run whatever you need and resets itself. One other option is to schedule via task manager a job every hour that starts access, and then access runs a macro to do your tasks and then quits.