![MS Access Tutorial](/ms_access/images/ms-access-mini-logo.jpg)
- MS Access Tutorial
- MS Access - Home
- MS Access - Overview
- MS Access - RDBMS
- MS Access - Objects
- MS Access - Create Database
- MS Access - Data Types
- MS Access - Create Tables
- MS Access - Adding Data
- MS Access - Query Data
- MS Access - Query Criteria
- MS Access - Action Queries
- MS Access - Create Queries
- MS Access - Parameter Queries
- MS Access - Alternate Criteria
- MS Access - Relating Data
- MS Access - Create Relationships
- One-To-One Relationship
- One-To-Many Relationship
- Many-To-Many Relationship
- MS Access - Wildcards
- MS Access - Calculated Expression
- MS Access - Indexing
- MS Access - Grouping Data
- MS Access - Summarizing Data
- MS Access - Joins
- MS Access - Duplicate Query Wizard
- Unmatched Query Wizard
- MS Access - Create A Form
- MS Access - Modify A Form
- MS Access - Navigation Form
- MS Access - Combo Box
- MS Access - SQL View
- MS Access - Formatting
- MS Access - Controls & Properties
- MS Access - Reports Basics
- MS Access - Formatting Reports
- MS Access - Built-In Functions
- MS Access - Macros
- MS Access - Data Import
- MS Access - Data Export
- MS Access Useful Resources
- MS Access - Quick Guide
- MS Access - Useful Resources
- MS Access - Discussion
MS Access - Duplicates Query Wizard
In this tutorial, we have created a variety of select queries, mainly from the Design View. But in Access, we can make use of some special query wizards to create a couple of specific select queries. The first one is Find Duplicates Query wizard. The Find Duplicates Query Wizard will create a query that locates records with duplicate field values in a single table or query.
As we have discussed that relational databases are designed to avoid storing duplicate information. But despite that design, sometimes users accidentally enter duplicate information.
Example
In a customer's table, you can have the same customer accidentally added twice. In such cases, the customer will have the same address, but different customer IDs, which can create problems with reporting. In this situation, you can make use of the duplicates query wizard to quickly locate possible duplicate entries.
Let us now open our Access database which contains tblAuthers table and go the Create tab and, in the queries group, select query wizard.
If you see the following screenshot, you have four different wizards to choose from. Select the find duplicates query wizard and click Ok.
![Duplicate Query](/ms_access/images/duplicate_query.jpg)
The very first screen of the find duplicates query wizard will ask what table or what query you want to search for possible duplicates. Let us say we want to check our author's table to make sure that the same author hasn't accidentally been entered twice. So, select tblAuthors and click Next.
![View Table](/ms_access/images/view_table.jpg)
![Author ID](/ms_access/images/author_id.jpg)
The second screen in the wizard will ask what fields might contain duplicate information.
Typically, you will not be using your primary key field, because, again, when you designate a field in Access as a primary key, Access will not allow duplicates to be entered.
We will look at any other field or a combination of fields.
We can search by the last name or the first name and the last name, or you can search by their street address, or to be more specific with their telephone number or birthday.
Let us now search by the first name, the last name, and birthday and click Next.
![Date Created](/ms_access/images/date_created.jpg)
The following screen in this wizard will ask for the fields we want to be displayed in our query. For this, hit the double arrow, all of the fields will move over to the additional query fields area, and will be added to our query results.
![Additional Query](/ms_access/images/additional_query.jpg)
Let us now click Next. It will take us to the last screen in this query wizard.
![Next Query Wizard](/ms_access/images/next_query_wizard.jpg)
In the following screen, enter how do you want to name your query.
![View Result](/ms_access/images/view_result.jpg)
By default, it's going to name it find duplicates for plus whatever the name of the object that you're querying. In this case, tblAuthors, but you can give it any other name too and click finish.
Here, Access has found a possible duplicate, and that's going to be author Jose Caline which has same birthday, same address, same telephone number but different AuthorIDs.
![Possible Duplicate](/ms_access/images/possible_duplicate.jpg)
This one has definitely been entered twice by accident. We have now added all of the fields to our query, we could just go and delete the record. We also have to make sure that we don't have any related records in another table.
![Related Records](/ms_access/images/related_records.jpg)
Select any record and choose Delete as in the following dialog box.
![Delete Record](/ms_access/images/delete_record.jpg)
Access gives you a prompt, “You are about to delete one record.” Click Yes if you want to continue.
If you'd like to see how that wizard has created this query, go into the Design View and see what all has been added to this query.
![Added List](/ms_access/images/added_list.jpg)
As you can see in the above screenshot, we have our fields and some specific criteria underneath the first name field.
![Specified Criteria](/ms_access/images/specified_criteria.jpg)
This is how this wizard is looking for that duplicate information. It is by far the easiest method to find duplicates.