In Microsoft Access, a Relationship helps you to merge or link data from one table to another. Relationships allow the user to create Queries, Forms, and Reports. When tables are created for each topic in a database, you must place common fields into the related table and form a relationship with them for information to be brought together again.
Create, Edit, Delete a Table Relationship in Access
There are three types of Relationships:
- One-to-One Relationship: One-to-One Relationship is the simplest kind of Relationship and the least common because the information related is stored in the same table. It links one table to a single record in another table; Primary Keys links tables. One- to- One Relationship can connect a table with many fields together and separate a table for security reasons.
- A One-to-Many relationship: One-to-Many Relationship is the most common Relationship; it links each record in one table to several records in another table. Only one of the fields been linked can be the Primary Key, and the Primary Key must have one record for many records in another table.
- Many-to-Many relationships: Many-to-Many Relationship requires a Junction Table, which includes the Primary Key column of the two tables you want to connect. Many-to-Many Relationship allows you to connect each row of one table to many rows in another table.
Why use table relationships in Access?
- Table Relationships updates your form and report designs – When you design a form and report, a Relationship is needed for Access to gather the information that can be placed in the form or report you have created.
- Table Relationships updates your query design – For records to work from multiple tables, a query must be created to join these tables. The query matches the values in the first table’s primary key field with the foreign key in the second table.
- Referential Integrity can be enforced in a table relationship – Referential Integrity helps to prevent orphan records in your database. An orphan record is a record with reference to another record that does not exist.
In this article, we are going to explain:
- How to Create a Relationship in Microsoft Access
- How to Edit a Relationship in Microsoft Access
- How to Delete a Relationship in Microsoft Access
How to Create a Relationship in Microsoft Access
Go to the Table Tab on the menu bar. Select Relationship In the relationship window, select Add Table. An add table dialog box will open; click on Add Selected Tables.
On the left corner in the tools section of the Relationship, window click on Edit Relationships. Select Create New.
In creating a new dialog box, you will choose the Left Table Name and the Right Table Name of your table, then choose the Left Column Name and Right Column Name, which should be the Primary Key of your tables; now click OK.
The Edit Relationship dialog box will be seen again with your selected choice; press create. There is also a shortcut option where you can drag the Primary Key from one table to another table; any table linked must be related to the Primary Key. This will form a relationship between the two tables.
How to edit relationships in Microsoft Access
You can modify your Relationships in Microsoft Access; here are a few steps in doing so.
Double-tap on the Relationship Line, and the Edit Relationship dialog box will show up.
There is another way of opening the edit relationship dialog box. On the Design Tab, you will see the Edit Relationship option; click on it.
Make whatever changes you want to make.
Deleting Relationships in Microsoft Access
To Delete a Relationship, you must remove the line from the two tables; these are the measures.
Right-click on the cursor, click Delete. The other option is to place the cursor on the line then press the Delete Key Button.
A dialog box will pop up asking you ‘if you are sure you want to permanently delete the Relationship.’
Click OK.
Related read: How to build Tables with Table Designer in Access.
Let us know in the comments if you have any problems, and we will get back to you.