Originally Posted by
mavisyew
...When any fields is empty which is required, and the user select to save the change, the system will not save the changes as the required field is empty...
How, exactly, is the user saving the changes? It's not by using a Command Button to Close the Form, is it? The only scenario that I've heard of, where this occurs is if the Form is closed using
DoCmd.Close
It has long been recommended that the code
DoCmd.RunCommand acCmdSaveRecord
or
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 or not a PK field has been duplicated, a PK field or other Required Field has been left blank or validation rules have been violated!
If one of these things occur, Access will simply dump the Record, Close the Form, and not tell the user that the Record has been dumped!
The code If Me.Dirty Then Me.Dirty = False or DoCmd.RunCommand acCmdSaveRecord 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.
Linq ;0)>
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007