Halt code execution when closing form

M

Marcus

A form holds some code that performs database health check.
As it can take some time to perform, it is possible to halt execution,
closing the form......
....but..... the underlying code, keeps executing......
Is there a statement that can terminate all code execution?
 
N

NetworkTrade

it may be compacting on close; which is an option that can be turned off...

but in terms of a custom written healthcheck there is no answer per se;
fundamentally yes, but specifically it depends on what the method is that
implements this code....there is no generic 'run no code' command I don't
think....and of course one must determine whether there is potential harm
done to the data integrity somehow if this function is short circuited...
 
M

Marcus

Breaking the code while performing those checks could be a problem? ADO
recordsets have a CursorType = adOpenForwardOnly....and fields stay
untouched they're only "read", no updates occur.

For every record in the loop, a call is issued to a function that provides
progress field update on the dialog, hence every 1% a doevents is issued
enabling textbox update and user input control...


In pseudocode:
....
do while not rs.EOF

updatemeter
....... do consistency checks
rs.movenext
loop
.....



updatemeter function

....every 1% of the recordcount in the set
.......... update progress field on dialog
.......... doevents

end function


If the cancel button is pressed, the dilaog is closed with a "DoCmd.Close
acForm, Me.Form.name" statement, but code in the loop keeps executing...
Maybe I could set a public flag that is set to true when the form is closed
and test it in the loop, if true issue a stop statement?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top