What do you mean by "create and save" the button? If you mean that you
are modifying a form using VBA, the answer is "Yes" - but it is not
quick and easy. Why not create an invisible button in form design, and
then make it visible as needed?
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.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.