RE: Updateing data when closing forms

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I'm guessing your close button uses DoCmd>close. It has long been recommended
that the code

If Me.Dirty Then Me.Dirty = False

be inserted before using

DoCmd.Close

to close a form because of a quirk in Access. When DoCmd.Close is used,
Access closes the form regardless of whether a validation rule or required
field rule has been violated! If one of these rules has been violated, Access
will simply dump the record, close the form, and not tell the user that the
record has been dumped!

Using

If Me.Dirty Then Me.Dirty = False

forces Access to attempt to save the record, and if a violation has occurred,
will throw up a warning message allowing correction to be made before closing
the form.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via http://www.accessmonster.com

.


Quantcast