Matt Dawson said:
Sorry I didn't make myself clear.
I meant a save and exit command button to simply save the record and exit
the form.
Records are automatically saved when you close a form. If you feel you really
need a button to close the form then you *should* actually save the record
explicitly in that code due to a bug in Access.
Me.Dirty = False
DoCmd.Close acForm, Me.Name
The Bug: If you close a form normally and there is an unsaved edit in the form
that does not comprise a legal record (required field missing for example) you
will get an error and warning message indicating that the dirty record cannot be
saved.
If you close the form with your own code, then that message is not shown. The
illegal record is discarded without the user being notified. By saving the
record first in your code you will be notified if the record cannot be saved for
some reason.