Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting duplicates

Status
Not open for further replies.

access345

Programmer
Nov 23, 2005
78
US
Hi,
I am trying to create a query that will delete duplicate records. I have done the first step and identified the duplicates. I copied an existing table and created a query to delete the duplicates. The problem I am finding is the query is deleting all the duplicate records even the original record which I need. I have included my query :

DELETE TblMasterPartList1.Codem_PN AS [Company_PN Field], TblMasterPartList1.Description AS [Description Field], TblMasterPartList1.VENDOR_PN AS [VENDOR_PN Field], TblMasterPartList1.Comapny_PN AS NumberOfDups, TblMasterPartList1.Company_PN, TblMasterPartList1.Description, TblMasterPartList1.VENDOR_PN, TblMasterPartList1.VENDOR_PN
FROM TblMasterPartList1
WHERE (((TblMasterPartList1.Codem_PN)>"1") AND ((TblMasterPartList1.VENDOR_PN)>"1"));


Can anyone help?
 
Have you seen:
Delete Duplicates (Save One From Each Group)
faq701-5721
 
I've found the easiest way (in my opinion) to delete duplicates is to create a copy of your table (structure only, not data). Then, in the copy, modify the structure of the table and set your unique field's indexed property to "Yes (No Duplicates)." Next, create an append query to append the data from the original table into the copy. You will be presented with a warning message stating that some records could not be appended due to key (or index) violations. Click Yes on the warning message, and your table copy should only contain the unique records.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top