How to Prevent Duplicate Location Records in Microsoft Access Forms
Question details
The user needs to prevent duplicate location entries in an Access form that utilizes cascading combo boxes and natural-key joins.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Designing a continuous-forms subform with cascading combo boxes where two locations must not point to the exact same combination of geographic fields.
- Observed behavior
- The current database design allows users to enter duplicate location records pointing to the same parish.
Ensure you have closed all active forms and created a backup of your Access database before modifying table schemas, as creating unique indexes will restrict new data entry and validate existing records.
Create a Composite Unique Index in Table Design
Applying a composite unique index ensures that the combination of Parish, District, and County remains unique across all records without restricting individual field values.
While natural keys are helpful for continuous forms and queries, using a composite unique index is crucial for preventing duplicate combinations. This setup allows the same parish name to exist in different districts, but completely blocks users from saving exact matching combinations across the indexed fields.
In Microsoft Access, right-click your underlying table (e.g., Locations_NatKey) in the Navigation Pane and select 'Design View'.
Click the 'Indexes' button located in the Show/Hide group on the Table Design ribbon.
In the Indexes dialog, type a new index name (such as 'UniqueLocation') in the first blank row under the Index Name column. In the Field Name column, select 'Parish'.
With the new index name selected, look at the Index Properties section at the bottom of the dialog and set 'Unique' to 'Yes'.
In the immediate rows below (leaving the Index Name column blank), select 'District' and then 'County' in the Field Name column. This groups them into a single composite unique index. Save the table.
Utilize the NotInList Event for Cascading Combo Boxes
Use VBA to handle the NotInList event when a user attempts to enter a new location combination that isn't already available in the dropdown lists.
Need a Lightweight Office Suite? Try WPS Office
While Microsoft Access handles complex database management, your daily document processing, data analysis, and presentation tasks can be completed seamlessly with WPS Office. Enjoy a familiar interface and robust tools without the hefty subscription fees.
- 1. Download WPS Office: Visit the official WPS Office website and download the free installation package for your operating system.
- 2. Install the Suite: Run the installer and follow the on-screen prompts to set up Writer, Spreadsheet, and Presentation tools on your device.
- 3. Open Your Documents: Launch WPS Office and directly open your existing DOCX, XLSX, and PPTX files with zero format loss.

Frequently Asked Questions
Why does my cascading combo box allow duplicate entries?
By default, combo boxes merely select or input data. If the underlying table lacks a unique index constraint for those specific fields, the database form will inherently permit users to save duplicate combinations.
What is a composite unique index in Microsoft Access?
A composite unique index is a database constraint applied to two or more fields simultaneously. It ensures that while individual fields can have repeated values across rows, the specific combination of all fields grouped in the index remains strictly unique.
Should I use natural keys or surrogate keys for continuous forms?
Natural keys can simplify queries and easily support correlated combo boxes in continuous forms. However, in larger operational databases, surrogate keys (like AutoNumbers) are generally preferred because they improve system performance and simplify backend relationships.




