Automatically delete duplicate records from a table
In this procedure, you create a copy of the structure of the table that contains duplicates, make primary keys of all the fields that contain duplicates, and then run an append query from the original table to the new table. Because fields that are primary keys can't contain duplicate records, this procedure produces a table without duplicate records.
To create a new table
- In the Database window, click Tables under Objects.
- Click the name of the table you want to delete duplicate records from.
- Click Copy on the toolbar.
- Click Paste on the toolbar.
- In the Paste Table As dialog box, type a name for the copied table, click Structure Only, and then click OK.
- Open the new table in Design view, and select the field(s) that contained duplicates in the table you copied.
- Click Primary Key on the toolbar to create a primary key based on the selected fields.
- Save and close the table.
To append only unique records to the new table
- Create a new query based on the original table containing duplicates.
- In query Design view, click the Query Type on the toolbar, and then click Append Query.
- In the Append dialog box, click the name of the new table from the Table Name list, and then click OK.
- Include all the fields from the original table by dragging the asterisk (*) to the query design grid.
- Click Run on the toolbar.
- Click Yes when you receive the message that you're about to append rows.
- Click Yes when you receive the message that Microsoft Access can't append all the records in the append query. This transfers only unique records to your new table and discards the duplicates.
- To see the results, open the table by clicking Tables under Objects in the Database window and clicking Open on the Database window toolbar.
- 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.