Results 1 to 5 of 5
  1. #1
    SGNTGH is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2019
    Posts
    6

    Change starting autonumber in a database

    Hi,

    I am in the midst of a research project where 2 separate sites are collecting data. Our initial site has been collecting for a while and our primary key (which links through a number of tables on a one to many basis) is Patient ID no. This is an autonumber field set by the main table and obviously generates a new autonumber for each ID as we go.

    The second site need to use a duplicate copy of the original database but obviously we don't want the ID numbers to be duplicated. I just want to therefore change the primary autonumber field so that instead of starting at 1 it starts at 500. I have tried the microsoft support guidance but got so far and realised the instructions wouldn't do what i thought they were going to.

    Any ideas? Seems like it would be a simple thing to do but never is with Access!

    Thanks,

    Sarah

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Create an append query that appends a record with 499 in the autonumber field. After you run it, 500 will be the next record created. You can delete the seed record after they start using it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,941
    The only purpose of a primary key is to uniquely identify a record. By starting autonumbers at different points you are giving it a meaning - the site is identified depending on the key value. might be better to include a field to indicate the site, then set the autonumber field to random rather than increment. And what happens if the first site has more than 500 records?

  4. #4
    SGNTGH is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2019
    Posts
    6
    Thanks both. The first site will not exceed 500 - we will stop recruiting well before we reach that number. We don't want any duplicate numbers because it is for a patient based research trial where all data has to be anonymised once an ID no is assigned to a patient and we can't risk accidentally assigning data to the wrong patient by having 2 databases with the same numbers, even if there is a field to identify the site.

    Append query sounds promising, thanks, but I am a serious beginner when it comes to Access! Will see if I can figure out how to do this query with my Access for dummies book...

  5. #5
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,425
    If your pc's are fairly robust and having unique id's is of VITAL importance (it seems it is) then you ought to consider the use of GUID data type as the primary key for patient. I don't know what the chances of duplication is (probably around 0.00000000000001%), but it's far better than your suggestion from that perspective. This is just an example to illustrate my point, but if you can monkey with the autonumber sequence, so can anyone else down the road. If that happens, will you duplicate? Who knows?

    The GUID data type is a large number, but it's the way it is built that pretty much guarantees uniqueness. Part of the value is clock based, part comes from the identification of the hard drive (serial number? I forget exactly). What is the chance that 2 hard drives that have the same contributing id doing something at the exact same clock millisecond? As if that were not enough, there are more parts to the ID number.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Starting a new database - Help needed
    By ChantalB in forum Database Design
    Replies: 9
    Last Post: 08-11-2017, 06:52 PM
  2. Starting new inventory database
    By Michael.Reynolds1775 in forum Access
    Replies: 1
    Last Post: 04-30-2015, 02:45 AM
  3. autonumber in access not starting at 1
    By b.saimsc in forum Forms
    Replies: 5
    Last Post: 10-16-2012, 03:45 AM
  4. Questions about starting first database
    By JM9x in forum Access
    Replies: 15
    Last Post: 09-10-2011, 04:26 AM
  5. Starting a new database
    By JFo in forum Access
    Replies: 9
    Last Post: 08-25-2011, 11:00 PM

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