Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    change autonumber in a table (Access 2000)

    Is it possible to change the autonumebr field of a table through a code?
    For example, I have an autonumber field called CustomerId in the tale Customers.
    This field begins the increment from 1. I want to begin the increment from 5000 on.
    How can I do it?

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: change autonumber in a table (Access 2000)

    I am sure this has been addressed in previous posts. Do a search to find them.
    Pat

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: change autonumber in a table (Access 2000)

    Make sure the table is empty (no records).
    Compact the database.
    Make a copy of the table.
    In the copy change the type of the AutoNumber field to Numeric Long.
    Insert one record in the new table and use 4999 as value for the Numeric Long field.
    Use a append query to append the new table to the empty Old table.
    Delete the record after the append.
    Next record will begin with 5000.
    Be aware that the counting of an autonumber field can be disrupted at any time.
    If a user create a new record and decide to not save the record, the autonumber that this record has used is loosed.
    If you need continuous numbering you have to manage it yourself.
    Francois

  4. #4
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: change autonumber in a table (Access 2000)

    Francois gave you details of how to change it, but I want to stress that your situation doesn't seem to call for an autonumber field. Autonumbers are best used when you won't even see them or when the actual number itself is meaningless (you don't care about skips, etc.). Otherwise, you should use a custom counter.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

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