What is a one-to-one relationship?
You might use one-to-one relationships if you have a table containing a list of items, but the specific information you want to capture about them varies by type. For example, you might have a contacts table in which some people are employees and other people are subcontractors. For the employees, you want to know their employee number, their extension, and other key information. For subcontractors, you want to know their company name, phone number, and bill rate, among other things. In this case, you’d create three separate tables—Contacts, Employees, and Subcontractors— and then create a one-to-one relationship between the Contacts and Employees tables and a one-to-one relationship between the Contacts and Subcontractors tables.
Create one-to-one relationships overview
You create one-to-one relationships by linking the index (usually the primary key) in one table and an index in another table which shares the same value. For example:
Car ID appears in both tables but is listed only once in each.
Often, the best way to create this relationship is to have the secondary table look up a value from the first table. For example, make the Car ID field in the Employees table a lookup field that looks for a value in the Car ID index from the Company Cars table. That way, you never accidentally add the ID of a car that doesn’t actually exist.
Important: When you create a one-to-one relationship, decide carefully whether to enforce referential data integrity for the relationship.
Referential data integrity helps Access to keep your data clean by deleting related records. For example, if you delete an employee from the Employees table, you also delete the benefits records for that employee from the Benefits table. But in some relationships, like this example, referential integrity doesn’t make sense: if we delete an employee, we don’t want the vehicle deleted from the Company Cars table, because the car will still belong to the company and will be assigned to someone else.
Create a one-to-one relationship steps
Create the one-to-one relationship by adding a lookup field to a table. (To learn how, see Build tables and set data types.) For example, to indicate which car has been assigned to a specific employee, you might add Car ID to the Employees table. Then, to create the relationship between the two fields, use the Lookup Wizard:
Open a table.
In Design View, add a new field, select the Data Type value, and then select Lookup Wizard.
In the wizard, the default is set to look up values from another table, so select Next.
Select the table that contains the key (usually a primary key) that you want to include in this table, and then select Next. In our example, you’d select the Company Cars table.
In the Selected Fields list, add the field that contains the key you want to use. Select Next.
Set a sort order and, if you prefer, change the width of the field.
On the final screen, clear the Enable Data Integrity check box and then select Finish.