In
Dave said:
How can I code a form to close without saving. do not want to even
save the autonumber
Any help here will be appreciated.
You can undo the form before closing it, to prevent the current record
from being saved (assuming that it hasn't been saved already):
Me.Undo
DoCmd.Close acForm, Me.Name, acSaveNo
(Note that "acSaveNo", above, refers to not saving changes to the form
design, *not* to discarding data changes. The "Me.Undo" takes care of
that.)
However, if a new autonumber has been generated, that number will not be
recovered. The next time you generate an autonumber, you'll get a
different one. That means you will naturally get gaps in the sequence
of consecutive autonumbers. This is a natural feature of autonumbers;
if it bothers you, you're probably using an autonumber for a purpose
that it wasn't intended for, and should be using your own code-generated
numbers instead.