The Find Unmatched Query, as its name implies, displays records in one table or query that have no match in a related table or query. For example, the Find Unmatched Query can be used to detect existing records in an inherited table that break rules of referential integrity for the database. In a sales database, for example, these might be records of orders made by a customer who does not exist in the primary customers table. When the user attempts to create a relationship and enforce referential integrity between these two tables or if he/she attempted to append new orphaned records to a table with a relationship established, Access will display an error message because of a referential integrity violation. The message states that current records in the table violate referential integrity rules, but it does not identify those records. A Find Unmatched Query will quickly discover the problem records.
Finding Unmatched Records
We will create a Find Unmatched Query to find any sections of courses that don't have enrollments. In other words, we will check to see which sections listed in tblSections are not listed in tblEnrollments.
Step1. Switch to the Create tab on the Ribbon, if necessary.
Step2. To start a new query wizard,
Click
Step3. To select and begin the wizard,
Double-Click Find Unmatched Query Wizard
Step4. To select the table and move to the next step of the wizard,
scroll down and Double-Click Table: tblSections
Step5. To choose the second table and move to the next step of the wizard,
Double-Click Table: tblEnrollments
Step6. To move to the next step of the wizard,
Click
Step7. To choose all fields to display,
Click
Step8. To move to the next step of the wizard,
Click
Step9. To name the query and finish the wizard, in the Name field, type:
qrySectionsWithoutEnrollments Enter key
Step10. Close the query.