Form Before update interferes with other procedures

S

Sammy

I have a before update procedure on a form which fires
during other procedures, such as a close form button and
a save record button. If the conditions of the before
update procedure are met, I want to cancel any other
procedures which may be running. What is the code to do
this? Does the code go in the form before update
procedure, or on the procedures that I want to cancel?
Thanks!
 
A

Allen Browne

If you cancel Form_BeforeUpdate, Access pops up a message asking the user if
they really want to close the form (and lose their entry), or if they want
to stay with the edit. It may not be idea, but it works better than most
alternatives. If you lock it down too tight, a user is likely to switch off
their computer without exiting properly, and the result is a corrupted
database file.

If you want to trap the message about the closing of the form, you can do so
in the Error event of the form.

If you want to prevent the user from closing the form, you can cancel the
Unload event of the form.
 

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