Results 1 to 3 of 3
  1. #1
    ijo68 is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Feb 2021
    Posts
    37

    Find Duplicate Query for multiple fields

    Hello All,
    I created a Find Duplicate Query for finding duplicate Phone numbers in a Phone1 field and it works great. (image below) .. But I have two phone fields and will like to find if a duplicate is in the other fields as well .. for example if the same number was entered in phone1 and in Phone2 fields. Is there a way to modify the query to check both fields for the same value?


    Click image for larger version. 

Name:	dup query.jpg 
Views:	10 
Size:	90.1 KB 
ID:	44640

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    normalise your data - if you can have multiple phone numbers, they should be stored vertically in a separate table, not horizontally in a single table.

    otherwise a workaround is to use a union query to normalise your data first - something like

    Code:
    SELECT ID, FName, Phone1
    FROM tblContacts
    UNION ALL SELECT ID, FName, Phone2
    FROM tblContacts
    then base your find duplicates query on that

    Note that ID is a poor name for a PK - use ContactID or similar so you know what it is ID of

  3. #3
    ijo68 is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Feb 2021
    Posts
    37
    Quote Originally Posted by Ajax View Post
    normalise your data - if you can have multiple phone numbers, they should be stored vertically in a separate table, not horizontally in a single table.

    otherwise a workaround is to use a union query to normalise your data first - something like

    Code:
    SELECT ID, FName, Phone1
    FROM tblContacts
    UNION ALL SELECT ID, FName, Phone2
    FROM tblContacts
    then base your find duplicates query on that

    Note that ID is a poor name for a PK - use ContactID or similar so you know what it is ID of
    Thank you for responding to my question.
    but I tried using this in a query not sure if I did it correctly.. I placed it as and expression in one query, then used that expression in the dup query..is that correct?


    I Figured it out .. Thank You very much for your help. I appreciate it.

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

Similar Threads

  1. Replies: 8
    Last Post: 12-16-2018, 06:45 AM
  2. Replies: 2
    Last Post: 05-21-2017, 05:40 PM
  3. Replies: 1
    Last Post: 03-10-2016, 01:01 PM
  4. Replies: 3
    Last Post: 11-12-2012, 10:44 AM
  5. Replies: 1
    Last Post: 04-30-2012, 08:42 AM

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