M
MariahJ
Hello,
I have developed an optimization tool in VBA using Access as a
back-end. The user clicks an "Optimize" button on a form to execute
code that takes approximately 2 minutes to run. I would like to have an
option to cancel this code execution, but my attempts to do this so far
have not worked.
If tried a "Cancel Optimization" button with the following code in it's
click event:
Private Sub CancelOpt_Click()
Dim canc As New optClass
optClass.gCancel = True
End Sub
The optClass is where the long optimization code is stored. In the
optClass I periodically have checks to see if gCancel is false
If gCancel = False Then 'user has not canceled
' run optimization
Else
GoTo opt_cancel
End If
However, I put a break point in the click event for the "Cancel
Optimization" button and found out the event never executes, so gCancel
always remains true. How can I force this event to execute?
Thanks in advance for your help,
Mariah
I have developed an optimization tool in VBA using Access as a
back-end. The user clicks an "Optimize" button on a form to execute
code that takes approximately 2 minutes to run. I would like to have an
option to cancel this code execution, but my attempts to do this so far
have not worked.
If tried a "Cancel Optimization" button with the following code in it's
click event:
Private Sub CancelOpt_Click()
Dim canc As New optClass
optClass.gCancel = True
End Sub
The optClass is where the long optimization code is stored. In the
optClass I periodically have checks to see if gCancel is false
If gCancel = False Then 'user has not canceled
' run optimization
Else
GoTo opt_cancel
End If
However, I put a break point in the click event for the "Cancel
Optimization" button and found out the event never executes, so gCancel
always remains true. How can I force this event to execute?
Thanks in advance for your help,
Mariah