-
How can I stop or cancel a process. Let say deleting a group of records in an Access table and I would like to have a CANCEL button on a dialog box for user to stop or cancel this process. Could anyone shows me how you could accomplished this? Thanks.
-
-
Code:
Dim KeepGoing as boolean
KeepGoing = true
'main process
Do While KeepGoing = true
'do your stuff here
DoEvents
loop
'put this in a button's event:
KeepGoing = false
as long as the KeepGoing variable is true, then the loop continues until finished.
KeepGoing is sometimes known as a "Flag" value.
DoEvents, simply pauses the loop and checks if anythink has happened to the program, like a user clicks a button, or a form is minimised etc...