How to suspend execution of code in VBA?

G

Guest

Hi,
In VBA for Excel there is something like Application.Wait to suspend
execution for some time.
But how to achieve this in Access 2003?
 
G

Guest

No idea if there is such a function available in MS Access but you can
allways use the following code which is all VBA so could conceivably be used
in all Office Automation tasks:

Sub PauseExecution(ByVal pauseTimeSeconds As Long, ByVal freeze As Boolean)

Dim pauseStartTime as Date

pauseStartTime = Date()
Do While Seconds(Date() - pauseStartTime) < pauseTimeSeconds
If Not freeze Then DoEvents
Loop

End Sub

You can use this sub to halt execution for pauseTimeSeconds seconds and you
can make the application 100% unresponsive with freeze = True (wouldn't
recommend it) or respond to events using freeze = false.
Let me know if this works for you.


"hstijnen" schreef:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top