How do you know if Form_BeforeUpdate is triggered by the form being closed?

P

Peter R. Fletcher

I use Form_BeforeUpdate to check for data sanity before the User is
allowed to proceed to the next record on a form. If the sanity check
fails, the Event is cancelled and the user gets to try again! This
works fine, except if the Before_Update Event is triggered by the form
closing (for various reasons, I would like to continue to allow the
user to have access to the regular X button). If the BeforeUpdate
event is cancelled under these circumstances, you get (or have to
trap) Access's "You can't save this record at this time" error. Is
there any way of finding out that the BeforeUpdate Event was triggered
by an attempt to close the form, rather than (e.g.) an attempt to move
to a different record.
 
T

TC

I'm not aware of any way (fudge or otherwise) to detect that they have
clicked the close box. So the easiest way to handle this would be to give
them a Close button and >not< let them use the close box. Then the button
can set a flag for form_beforeupdate.

HTH,
TC
 
P

Peter R. Fletcher

I was afraid of that!

I'm not aware of any way (fudge or otherwise) to detect that they have
clicked the close box. So the easiest way to handle this would be to give
them a Close button and >not< let them use the close box. Then the button
can set a flag for form_beforeupdate.

HTH,
TC
 

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