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

    Unanswered: Preventing AutoNumber increase

    I have a data entry form that is organized by an ID (AutoNumber). I have created a Save and Cancel button on the form. Once I start entering data into the form, the AutoNumber increases. If I click Save, all is well, but if I click Cancel to eras the data, the AutoNumber is still increased. In other words, if I type some data and Cancel the form, the data is discarded but the next AutoNumber in line is used. If I reopen the form, the AutoNumber is out of order because it has skipped one. Is there any way to prevent this?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    why do you want to?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Sep 2004
    Location
    Raleigh, NC
    Posts
    146
    Because the AutoNumber is an Order ID Number. I don't want holes in my order numbers. We use the number to track customer orders.

  4. #4
    Join Date
    Aug 2004
    Location
    Cary, NC
    Posts
    264
    Autonumbers are unique, not necessarily sequential. If you need to have sequential numbers in your application you would need to generate them on your own. If you generate them yourself you are also taking the responsibility of making them unique. Generally you just accept the fact that there are holes in the sequence and go with it.

    Steve

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by smacdonaldnc
    I don't want holes in my order numbers.
    i understand that, but i do not understand why

    why do you not want holes?

    can you explain how a number that isn't there will affect existing orders, or affect any of your application order logic?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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