Results 1 to 2 of 2
  1. #1
    jbh02 is offline Novice
    Windows Vista Access 2007
    Join Date
    Sep 2009
    Posts
    3

    Merge Duplicate records and Maintain relationships?

    I have a messed up database not mine I inherited it. It contains duplicate records in one table. I need to get rid of all but one of each record. The trouble is that all the duplicates have a separate primary key to related information in other tables. It should just be one to many instead of many (duplicates) to many related data.

    I need to merge each duplicate into one primary key id in table, but also reassign the foreign key on the records in the other related tables to the single remaining primary key id in the first table.

    If I just delete the duplicates I lose the related data in other tables that I need to keep and relate to the sole remaining primary key.

    Any VBA code examples out there that could get me started?

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    you indeed have a mess....

    the general strategy is this: make a new field in both tables named SuperKey - - then enter a unique value in both tables where the parent/child should exist; once that is done correctly then delete the duplicates in the parent table.

    implementing the general strategy can be tricky...if there is a manageable amount of records you could do it by hand....if not you are going to need to do it via calculated fields or some particularly good sql - the explanation of which is probably beyond this forum...

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

Similar Threads

  1. Delete duplicate records
    By Zukster in forum Queries
    Replies: 1
    Last Post: 08-26-2009, 03:14 AM
  2. Name Merge
    By leejqs in forum Reports
    Replies: 3
    Last Post: 07-16-2009, 07:02 AM
  3. Merge two fields
    By daviddoria in forum Access
    Replies: 0
    Last Post: 01-31-2009, 09:12 AM
  4. Appending Records to tables with relationships
    By RubberStamp in forum Import/Export Data
    Replies: 0
    Last Post: 12-14-2008, 06:52 AM
  5. Mail merge
    By grgerhard in forum Forms
    Replies: 0
    Last Post: 04-25-2006, 05:06 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