Pausing a loop

  • Thread starter Thread starter H. Martins
  • Start date Start date
H

H. Martins

I have a Access VBas routine with a loop. I need to pause that loop
(without leaving it) for about one minute.

Of course I could read the clock, store it's time adding one minute
and compare it against current time in a sub-loop, but I suppose that
would trigger the CPU in full load.

Any more clever way to get the same result?

H. Martins
 
Try the Sleep API function:

Declare Sub Sleep Lib "kernel32" (ByVal millisecs As Long)
....
Sleep 5000 ' pause for 5 seconds
 
Private Declare Sub sapiSleep Lib "kernel32" _
Alias "Sleep" _
(ByVal dwMilliseconds As Long)


I suppose there is a propper place to put this declaration. Where is
it?

H. Martins
 
In the declarations section (before the first Sub or Function) of the module
where it is used.

If you use it in several modules, you can declare it "Public" instead of
"Private".
 
Back
Top