Results 1 to 9 of 9
  1. #1
    gwboolean is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    65

    auto number fields


    Can the starting number be defined by the user in an autonumber fields. i.e. start as say 1000 instead of 1?

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Yes. Make a copy of everything. Then, delete all of the records from the table you wish to assign the start number. Now, do a compact and repair. The C and R will reset the Autonumber.

    Copy your table via Right Click and paste directly into the Navigation Pane. Open you new table in design view. Change the Autonumber to Long Integer. Save your table. Open your table in Datasheet View and create a new record. Type 999 or 998 or 997 into the PK that is now type Long. Add data to the required fields, adding data to at least one of the many columns.

    Now you need to append to your table that has no records and the Autonumber. Create a query and change the type to Append. Drag the Copy table onto the Designer Surface. Select the necessary columns and add them to the Design Grid. Run your query.

  3. #3
    gwboolean is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    65
    ItsMe,

    thanks. The table I have is new and has no records yet. How would I do it for no records yet?

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Same way. The idea of deleting records and doing a compact and repair is to reset the counter for Autonumber. So, if the latest PK in your Autonumber was 52452, it is likely you will not be able to append a record to that table with a value less than 52452

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Have Autonumber field start from a value different from 1
    http://access.mvps.org/access/tables/tbl0005.htm

    But why would you want to do this?

    You might want to read this:
    Autonumbers--What they are NOT and What They Are
    http://www.utteraccess.com/wiki/index.php/Autonumbers

  6. #6
    gwboolean is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    65
    What I have in mind ssanfu is this. This is a database that I previously had and in which I was using a 10 character smart numbering system for the identity of items, documents, etc. It has taken me a long time to get over the use of smart numbers, but I am over it and ready to move on. So all I now need is a unique incrementing number for the id number of all of the previously mentioned table items/records. However, I want to start at 1000000 instead of 1. If I could do that with a auto number field that would be ideal.

    ItsMe,

    I will see if I can work through that. Thanks.

  7. #7
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    OK.....

    Another option: you could always use a custom autonumber field (ie roll your own numbers)

    See BaldyWeb.com http://baldyweb.com/CustomAutonumber.htm

  8. #8
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Just curious about this
    However, I want to start at 1000000 instead of 1.
    What's the rationale?

  9. #9
    gwboolean is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    65
    The rational is based on a need to have a 8 character/digit part/Item number for each item added to table. I wanted to start with 10000000 because I wanted to skip through all values below that. The reason being that for most part/item numbers no one wants values like 00000001.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 11-30-2014, 12:46 PM
  2. Replies: 3
    Last Post: 05-03-2014, 11:00 AM
  3. Auto number automatically next number
    By wnicole in forum Access
    Replies: 3
    Last Post: 10-17-2013, 08:45 AM
  4. Auto Number
    By sah in forum Forms
    Replies: 1
    Last Post: 04-30-2012, 07:20 AM
  5. Need help with an auto number
    By Wrangler in forum Database Design
    Replies: 1
    Last Post: 02-10-2006, 03:21 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums