Results 1 to 8 of 8
  1. #1
    andigirlsc is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    8

    Red face Merge duplicate/similar records into 1 record in Access 2010

    Is there a way to merge duplicate/similar Access 2010 records into one record? I have researched this question numerous times and have not found an answer specific to my needs.

    I have an Access table with 1,000 duplicate records, although they are similar and not exact duplicates. As you can see below, some records contain information that other records do not. Yet, the primary key is the same for all duplicate records. I want to find a way to merge data from filled cells of duplicate records into empty cells for each duplicate record. I do not want to concatenate the data (i.e. combine last and first name, etc.). I only want to fill empty cells if there is a match for it in a duplicate record. I will delete the newly exact duplicate records later. Short of correcting the records by hand, (which is what I’m doing now) I do not have a solution.

    Thanks!

    Code:
    LastName  FirstName  SSN           Address          Phone         Email
    Doe       John       123-45-7891   123 Anywhere St. NULL          john(at)gmail.com
    Doe       John       123-45-7891   NULL             (123)456-7890 NULL
    Desired Result
    Code:
    LastName  FirstName  SSN           Address          Phone         Email
    Doe       John       123-45-7891   123 Anywhere St. (123)456-7890 john(at)gmail.com
    Doe       John       123-45-7891   123 Anywhere St. (123)456-7890 john(at)gmail.com


  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    I would:
    add all of tbl1 to a new table
    then join new tbl to the second table
    and 1 field at a time, update new tbl.fld (from tbl2.fld) if new.field = null

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    what is the primary key? what if a field has more than 1 different response, for instance this person in your exampl ehad 123 anywheres st. and 123 anywhere st., a slight misspelling but they would be treated as different values.

    If you are looking at compressing your data you can create a table that has the exact same fields you have now and create an AGGREGATE query (look for the sigma button on your query design toolbar that looks like a capital E)

    in your TOTAL row, instead of having GROUP BY for all your fields (except your primary key field) put in either MIN or MAX you will get a single value for all your non primary key fields.

    Once you've worked out if this is giving you what you want you can turn it into an APPEND query and attach it to your summarized table.

  4. #4
    andigirlsc is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    8
    What would the VBA code look like for this? Or, is this a query condition in design mode?

  5. #5
    andigirlsc is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    8
    Quote Originally Posted by ranman256 View Post
    I would:
    add all of tbl1 to a new table
    then join new tbl to the second table
    and 1 field at a time, update new tbl.fld (from tbl2.fld) if new.field = null
    What would the code look like for this? Is this a VBA statement I would need to write or a condition in a query?

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    No vba involved really, just a SELECT aggregate query, once you verify results you can turn it into an APPEND query to a new table.

  7. #7
    andigirlsc is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    8
    Quote Originally Posted by rpeare View Post
    what is the primary key? what if a field has more than 1 different response, for instance this person in your exampl ehad 123 anywheres st. and 123 anywhere st., a slight misspelling but they would be treated as different values.

    If you are looking at compressing your data you can create a table that has the exact same fields you have now and create an AGGREGATE query (look for the sigma button on your query design toolbar that looks like a capital E)

    in your TOTAL row, instead of having GROUP BY for all your fields (except your primary key field) put in either MIN or MAX you will get a single value for all your non primary key fields.

    Once you've worked out if this is giving you what you want you can turn it into an APPEND query and attach it to your summarized table.
    The primary key is the SSN (Social Security Number). I'm not sure what to do if some fields have slightly different values, hence the post for help. Thank you for bringing that to my attention, however. I will try this out and let you know if it works for me. Thank you!

  8. #8
    andigirlsc is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    8
    Quote Originally Posted by rpeare View Post
    what is the primary key? what if a field has more than 1 different response, for instance this person in your exampl ehad 123 anywheres st. and 123 anywhere st., a slight misspelling but they would be treated as different values.

    If you are looking at compressing your data you can create a table that has the exact same fields you have now and create an AGGREGATE query (look for the sigma button on your query design toolbar that looks like a capital E)

    in your TOTAL row, instead of having GROUP BY for all your fields (except your primary key field) put in either MIN or MAX you will get a single value for all your non primary key fields.

    Once you've worked out if this is giving you what you want you can turn it into an APPEND query and attach it to your summarized table.
    This completely fixed my problem! Thank you so much! I searched for days and couldn't find an answer. This is it!

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

Similar Threads

  1. Replies: 8
    Last Post: 06-27-2014, 11:30 AM
  2. Mail Merge - Access 2010 - drop down field
    By lynnmc26 in forum Access
    Replies: 2
    Last Post: 01-14-2014, 05:54 PM
  3. Merge Several tables into one -Access 2010
    By sylviar in forum Access
    Replies: 6
    Last Post: 04-22-2013, 03:51 PM
  4. Replies: 3
    Last Post: 05-04-2012, 12:04 AM
  5. Replies: 1
    Last Post: 11-10-2009, 03:12 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