Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
programming4us
Windows 7

Microsoft Access 2010 : Relationships Explained, Enforcing Referential Integrity

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
11/29/2012 11:06:46 AM

1. Relationships Explained

1.1. One-to-Many Relationships

One of the strengths of Access is the ability to create relationships between tables. As an example of a relationship, consider the Customers and Orders tables from the Northwind sample database.

In the Northwind business case, every order comes from a single customer. Of course, a customer can place more than one order, which means that the Customers and Orders tables are in a one-to-many relationship with the Customers table on the "one" side and the Orders table on the "many" side.

1.2. Many-to-Many Relationships

It is also possible for two tables to be in a many-to-many relationship, where multiple records from one table relate to multiple records from another table. As an example, consider the Products and Orders tables in the Northwind database: A product can be included in many orders, and an order can include many products. The problem is that you can’t relate the two tables directly without adding fields to the Orders table to hold spots for more than one item, as in the following incorrect example.

This table is poorly designed because it forces you to enter data about the customer and the order in each record, instead of just once, and an order can’t be for more items than you have spots in the table. The proper way to manage the relationship is to create a transition table, which bridges the gap between the Products and Orders tables. In the Northwind database, the Order Details table is a transition table.

The Order Details table is on the "many" side of two one-to-many relationships—the first with the Products table, and the second with the Orders table. By bridging the two tables, it lets you manage the relationship between the Orders and Products tables without resorting to improper table design.

2. Enforcing Referential Integrity

When you create a relationship between two tables, you need to make sure that data in the two tables remains consistent. If you no longer order from a supplier, you would want all products from that supplier deleted from the Products table when you delete the supplier’s data from the Suppliers table. Enforcing referential integrity lets you do that.

2.1. Enforce Referential Integrity

  1. Click the Database Tools tab.

  2. Click Relationships.

  3. Double-click the line representing the relationship you want to edit.

  4. Select the Enforce Referential Integrity check box.

    • Selecting the Cascade Update Related Fields check box means Access 2010 will change the values in foreign key fields when the corresponding primary key field’s value is changed.

    • Selecting the Cascade Delete Related Records check box means that deleting a record from the primary field in a relationship will cause Access 2010 to delete all related records in the second table.

  5. Click OK.

  6. Click the Save button.

  7. Click the Close box of the Relationships window.

Other -----------------
- Troubleshooting Stop Messages : Common Stop Messages (part 4)
- Troubleshooting Stop Messages : Common Stop Messages (part 3)
- Troubleshooting Stop Messages : Common Stop Messages (part 2)
- Troubleshooting Stop Messages : Common Stop Messages (part 1)
- Troubleshooting Stop Messages : Being Prepared for Stop Errors, Stop Message Checklist
- Your Life in Sync—Windows 7 and Live Services : Beyond Windows Live: The Mesh
- Windows Live Services That Make Windows 7 Better (part 5) - Windows Live Essentials
- Windows Live Services That Make Windows 7 Better (part 4) - Windows Live SkyDrive, Windows Live FrameIt, Windows Live Groups
- Windows Live Services That Make Windows 7 Better (part 3) - Windows Live Photos, Windows Live Spaces, Windows Live Events
- Windows Live Services That Make Windows 7 Better (part 2)
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server