Checking for Cancel in Loop

Checking for Cancel in Loop

I have started using VB3 yesterday to do a small project. I use Access normally. I wish to set use one button to initiate a loop and another button to stop the loop.I have seen your response to a similar question where you said to set a flag to false in the second button and to check for it in the loop. However I cant seem to get the program to allow me to click the second button when it is running.Can you show me some snippets of code?

Within the loop right before you check the flag, put in the DoEvents statement. That will tell the system to check to see if any Windows events have happened and to process them. Otherwise, the program will seem to ignore the button press.


Share the Post: