You may not use one-to-one relationships very often, but you should know how to create them. One-to-one relationships use a primary key and a foreign key, just like one-to-many relationships. The difference lies in how you set indexes for each key field. Indexing a field allows Access to search for data faster. It can also prevent users from adding duplicate records.
In a one-to-many relationship, the primary key has indexing turned on, but the foreign key field has indexing turned off. In a one-to-one relationship, both key fields have indexing turned on, and neither field allows duplicate values.
You use Design View to turn on indexing for your foreign key fields. It's easiest to do this with blank tables.
In the Navigation Pane, right-click the table that contains the foreign key field, then click Design View
In the designer, click the foreign key field.
Under Field Properties
, on the General
tab, click the list next to Indexed
and select Yes (No Duplicates)
Save your changes — and there you go. For more information about indexes and duplicate values, see the links in the Quick Reference Card at the end of this course.