how to code "close without saving"

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

How can I code a form to close without saving. do not want to even save the
autonumber

Any help here will be appreciated.

Thanks in advance
Dave
 
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.
 
Thanks Dirk,

Thants what I needed.
And you are right - I might need to reconsider my numbering system.

Dave
 

Ask a Question

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.

Ask a Question

Back
Top