?
Solved

find duplicate records in MS Access

Posted on 2003-11-03
3
Medium Priority
?
899 Views
Last Modified: 2011-09-20
Could anyone can tell me how to find all the duplicate records in a table and delete the duplicate? Thanks a lot!
0
Comment
Question by:omanca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 9676852
Try something like:

Delete  from table1 where id in

(

Select ID from Table1 Where [referkey] in (
SELECT [referkey] FROM [Table1] As Tmp GROUP BY [referkey] HAVING Count(*)>1
) And iD not in (        

SELECT  Min(ID) AS MinKey from table1 Group by TAble1.referkey

)

)

?
0
 
LVL 77

Accepted Solution

by:
peter57r earned 300 total points
ID: 9676875
It depends on how many records and duplicates you think you have. and what you want to do in the future.

If you start a new query you have a Find Duplicates query wizard which will show you all occurrences of the duplicated records.
If the numbers are small you could then manually delete the unwanted ones.

If you have too many for that then you you can use a trick.

Copy the table containing the duplicates. (Right-click the table name and select copy)
Paste and select Structure only.  Use a name of your choice.

Now modify the design of the copy to prevent any duplicates occuring.
To do this set the primary key or create a unique index based on the fields which  identify the duplication.

Now create an append query which appends records from the original table to the new table.

When you run this query all duplicates will be rejected and you can rename the old and new tables.

Pete




0
 
LVL 2

Author Comment

by:omanca
ID: 9676910
Thanks Pete,
It was good enough to know that there is a "Find Duplicates query wizard"

Omanca
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question