Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2004
    Location
    Raleigh, NC
    Posts
    146

    Unanswered: AutoNumber Question

    I have a command button on a form (Main) that opens another form (New) so that I can add a new record to a table. I have included two command buttons on (New) - a 'Save' button and a 'Cancel' button. Now if I enter content into the fields and select 'Save', everything is just fine and the record is added to the table with the next available RecordID (which is an AutoNumber). The problem that I've noticed though is that if I open the form (New) to add a record and I select 'Cancel' (to close the form)... Access moves to the next RecordID even though nothing was entered. If I then attempt to add another record, a RecordID is missing... there is a void. My question is how do I avoid losing RecordID's like this?

    Example: Last known RecordID is 10. I open the (New) form and then realize I need to close it, so I click 'Cancel'. If I go back into the form at a later time and add a new record, the RecordID is now 12 instead of being 11. The RecordID 11 has been lost somehow.

    Also, along the same lines.. I'm entering "dummy" information into the database for testing purposes right now. Once everything is determined to be running fine, how do I "reset" my AutoNumbers to restore the database to an empty condition?

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    I've found the easiest way to do this was to use unbound controls and execute an insert statement when the "Save" button is pressed.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •