validation when clciking X button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

a I have a form which bounds to a table. I want to show confirmation message
if the data has changed when user click X button on the right top of screen.

I cannot use me.dirty in the form unload event since it is always false.
Whatelse can I do to achieve this?
 
Whatelse can I do to achieve this?

Use the Form's BeforeUpdate event. Set its Cancel argument to True if
you want to block any changes to the data in the table.

John W. Vinson[MVP]
 
Thanks John, your information is very hepful and I have made the changes
according to your suggestion :-)
 
Hello John

I made the changes according to your suggestion -- moved the validation
codes to form_beforeupdate event. Most of time BeforeUpdate event fires
before data get saved to DB. I was happy for a while.

However, lately, I noticed that Form_BeforeUpdate is not fired sometimes. I
don't know why. It looks like it only happens if I have abutton on that form
and that button will open another form which has a subform on it. So if user
click this kind of button, the unvalidated record got saved into db without
any warning. Any idea? How can I make sure that unchecked data cannot be
saved to DB?
 
Back
Top