Microsoft KB Archive/209183

= How to delete duplicate records from a table in Access 2000 =

Article ID: 209183

Article Last Modified on 7/29/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q209183





For a Microsoft Access 97 version of this article, see 109329.

Novice: Requires knowledge of the user interface on single-user computers.



SUMMARY
This article describes how you can remove duplicate records from a table by using primary keys. By using this method, you can check for duplicate values in up to 10 fields in the table.



MORE INFORMATION
To remove duplicate records from a table, follow these steps:  Make a copy of the structure of the table from which you want to remove the duplicate records.

To copy a table:  Select the table in the Database window On the Edit menu, click Copy. On the Edit menu, click Paste. Enter a name for the new table. Select Structure Only</li> Click OK.</li></ol> </li> Open the new table in Design view.</li> Select the field(s) that contain the duplicate values.</li> To make your selection the primary key for the table, click the Primary Key button on the toolbar.</li> Save and close the table.</li> Create an append query based on the original table containing duplicates.</li> In the query Design View, on the Query menu, click Append Query.</li> In the Append dialog box, click the name of the new table from the Table Name list, and then click OK.</li> Include all the fields from the original table by dragging the asterick (*) to the query design grid.</li> On the Query menu, click Run.</li> Click Yes in the dialog box advising you that you are about to append records.</li> Because the Primary Key field(s) in the new table will not accept duplicate values, the following error message will be displayed:

Microsoft Access can't append all the records in the append query.

Microsoft Access set 0 field(s) to Null due to a type conversion failure, and it didn't add record(s) to the table due to key violations, 0 record(s) due to lock violations, and 0 record(s) due to validation rule violations.

Do you want to run the action query anyway?

To ignore the error(s) and run the query, click Yes. For an explanation of the causes of the violations, click Help.

</li> Click Yes.</li> View the contents of the new table. When you're sure the new table has the correct unique records, you can delete the original table, and then rename the new table using the name of the original table.</li></ol>

<div class="references_section">