Link to home
Create AccountLog in
Avatar of RalphyC
RalphyC

asked on

How to pause execution of VBA code in MS ACESS

I would like to pause an execution of VBA code in the MS ACCESS, I have a loop that will run multiple times and update a table records with each loop. I would like to pause for 10 sec after each time loop goes to next record and display a status bar message that I know how to do. I do not want use the MsgBox for user to click OK, I want this to be controlled by VBA code and set to specific time.
Avatar of VicRauch
VicRauch
Flag of Austria image

The form to displays the status message, open it as a Pop-up and Modal form.  By being a Modal form, it will stop the execution of VBA code right where it is opened.  Set the Timer value to 10 seconds (10 x 1000).  Set the OnTimer event procedure to close the form.  
This will cause the OnTimer event to fire after 10 seconds, and the on timer event will close the form.  At this point your VBA code will start executing again, right after the line that opened this status message form.
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer