Results 1 to 4 of 4
  1. #1
    accessbunny is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2020
    Posts
    10

    Delete all records from a table that match records in a duplicates query I have made?

    Hello,



    I made a query for duplicates called Dupes, and then a second query called Unwanted that only shows the Max of ID for each duplicate (So it lists 1 of each duplicate record for todays date).

    Basically, I want to delete all records that match MaxOfID field from the Unwanted query to the ID field in my table MasterRoster. What can I put in the criteria box for my "Where" to make it do this?

    (No, I cannot prevent future duplicates. This query will be ran on a regular basis by the team being given the database because they tend to input duplicate entries and want an easy way to clear them out each day.)

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,845
    create a delete query something like

    DELETE *
    FROM MasterRoster
    WHERE ID IN (SELECT MaxofID FROM Unwanted)

  3. #3
    accessbunny is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2020
    Posts
    10
    That worked, thank you very much!

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,845
    you may have to run it several times if your users have entered more than two duplicates

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

Similar Threads

  1. Replies: 1
    Last Post: 10-07-2015, 11:33 AM
  2. Replies: 8
    Last Post: 02-09-2014, 07:25 PM
  3. Replies: 4
    Last Post: 12-30-2013, 01:49 PM
  4. Replies: 5
    Last Post: 01-24-2012, 06:19 PM
  5. Replies: 2
    Last Post: 01-24-2012, 02:16 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