Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    Join Date
    Apr 2017
    Posts
    1,681
    In case you need to create new autonumbers for some table:

    Find a time, nobody uses database (or simply restrict access for other users for period you need);
    In table where you want new autonumbers (e.g. table MyTable with field MyKey), add a field e.g. MyOldKey (Long Integer);
    Copy the table with new name (e.g. MyOldTable);
    Delete all entries in MyTable, and COMPACT THE TABLE after that.
    Use Insert query to import all records from MyOldTable into MyTable - the cuery must not have field MyKey (it is generated automatically), and must have field MyOldKey filled with values from field MyKey in MyOldTable
    In any tables which have a foreign key linked to autonumeric field in MyTable, add a field MyOldKey (Long Integer);
    Update every linked table, setting MyOldKey = MyKey, and MyKey = Null (In case the field is unique index somehow, or with Null's restricted, remove the index or restriction until the end of processing);
    Update every linked table, setting field MyKey = MyTable.MyKey where MyOldKey = MyTable.MyOldKey;
    From every linked table, delete records where MyOldKey remains empty (Those are 'orphan' records);


    Delete table MyOldTable, and field MyOldKey from every table processed.
    Last edited by ArviLaanemets; 12-28-2018 at 12:06 AM.

  2. #17
    hammerman is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Jul 2014
    Posts
    32
    Thank you all for your help!
    I used Gicu's recommended process, essentially: I deleted the records that were the problem; {saving that info elsewhere first}, then exported both tables to Excel, and matched the two tables keyed on the auto number key, and removed orphans; Then imported the Excel files, {renaming the old ones first}, and the issue is gone. I'm able to add the 20 + new records that I couldn't before. I also checked the 'similar threads' links below. All is well. Thank you all, again!

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 03-19-2013, 09:36 PM
  2. Replies: 19
    Last Post: 12-21-2012, 06:57 AM
  3. AutoNumber within a Range
    By rajgoyal00 in forum Forms
    Replies: 3
    Last Post: 02-15-2012, 10:02 PM
  4. Replies: 1
    Last Post: 02-02-2012, 08:34 PM
  5. Replies: 1
    Last Post: 11-15-2011, 02:50 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