pause procedure

R

Richard

Hi

I have aprocedure that runs for 2 hours. Is there a way that if I want to
pause it, I just press on esc and a msgbox comes up, and when I press ok on
the form, the code continues (and not rerun)

Thank is advance
Richard
 
A

Arvin Meyer

Richard said:
Hi

I have aprocedure that runs for 2 hours. Is there a way that if I want to
pause it, I just press on esc and a msgbox comes up, and when I press ok on
the form, the code continues (and not rerun)

You may be able to set a boolean variable (true/false) with a toggle button
or checkbox and check for it periodically in your code. Use:

DoEvents

to pause your code and temporarily relinquish control to the OS (which will
allow you to check the condition of the boolean.)
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
R

Richard

Hi Arvin

So if I set a boolean to true if I need to stop, should I do it:

If blPause = true then
run sleepfunction (Or is there a code to hold it here)
end if

Thanks again
Richard
 
A

Arvin Meyer

Richard said:
Hi Arvin

So if I set a boolean to true if I need to stop, should I do it:

If blPause = true then
run sleepfunction (Or is there a code to hold it here)
end if

Thanks again
Richard

Yes, that's it. I'd use a toggle button instead of anything else since it's
really obvious to the user whether it's true or false.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Top