2010-09-15 04:58:16 UTC
validation before saving a record. Ex:
If IsNull(Me.LastName) then
msgbox "Please enter a last Name"
Cancel = True
I might have a command button called Exit where I can save the record
Me.Dirty = False
and trap the error if I attempt to close the form and not exit.
If I have nav buttons, it won't permit me to go to another record or a
new record until I've satisfied the error condition.
If I hit the X button in the upper right corner of the window to exit,
it runs the BeforeUpdate event, displays the error message, and closes
If it is a new record, the data is not saved. The form just closes.
There is no way to correct the error.
Do you employ any methodology to
1) not show the msgbox?
2) keep the form, with its data, open if in error? New or old rec?
3) use another event to trap/find errors?