1-1 relationship between tables in ACCESS

1-1 relations are used to link a record from one table to one and only one record in another table.

1-1 relations are used to link a record from one table to one and only one record in another table.

One-to-one relationships are created when both connection fields are primary keys or have unique constraints.

For further clarification, continue with the database and the tables we created in the previous lesson. First, go to the Database Tools tab.

1-1 relationship between tables in ACCESS Picture 11-1 relationship between tables in ACCESS Picture 1
New tblHR Data table is created

Click on Relationships option .

1-1 relationship between tables in ACCESS Picture 21-1 relationship between tables in ACCESS Picture 2
The Show Table dialog box appears

Select the Members panel and tblHRData, click Add to add both tables to the working screen and then close the Show Table dialog box .

1-1 relationship between tables in ACCESS Picture 31-1 relationship between tables in ACCESS Picture 3
Both tables tblNhanvien and tblHRData are added to the screen

To create a relationship between these two tables, use the mouse to click and hold the NhanvienID field in the tblNhanvien table , drag the connection to the field you want to connect to in table tblHRData. When you release the mouse, Access will open the following window:

1-1 relationship between tables in ACCESS Picture 41-1 relationship between tables in ACCESS Picture 4
Drag the two NhanvienID fields of the two tables together to display the Edit Relationships dialog box

This window relates to the tblNhanvien 's NhanvienID and NhanvienID of tblHRData. Click on the Create button and now these two tables are connected, establishing a relationship with each other.

1-1 relationship between tables in ACCESS Picture 51-1 relationship between tables in ACCESS Picture 5
Two tables after establishing a relationship will show up like this

This relationship is automatically saved by Access without saving . Recently we have created the most basic relationship, next, choose each table to see if there is anything different from the beginning.

You open the table tblNhanvien.

1-1 relationship between tables in ACCESS Picture 61-1 relationship between tables in ACCESS Picture 6
The tblNhanvien table has not seen a change

Normally on the left side of each record, you will see a small plus sign by default. When creating a relationship, Access automatically adds a child datasheet to the table.

1-1 relationship between tables in ACCESS Picture 71-1 relationship between tables in ACCESS Picture 7
A child datasheet appears when you click on the small plus sign before the record

Click the plus sign and you will see information related to the records available on the tblHRData table .

1-1 relationship between tables in ACCESS Picture 81-1 relationship between tables in ACCESS Picture 8
Enter the required information right in this datasheet

Click on the Save icon and open tblHRData, you will see the entered data already here.

1-1 relationship between tables in ACCESS Picture 91-1 relationship between tables in ACCESS Picture 9
Data entered directly in tblNhanvien table are connected and appear in table tblHRData

Previous article: Establish relationships between tables in Access 2016

Next lesson: 1-n relationship between tables in ACCESS

3.9 ★ | 9 Vote