Logo
HOW TO
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
 
 
Windows 7

Microsoft Access 2010 : Relationships Explained, Enforcing Referential Integrity

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)
 
 
REVIEW
- First look: Apple Watch

- 10 Amazing Tools You Should Be Using with Dropbox

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
 
VIDEO TUTORIAL
- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 1)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 2)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 3)
 
Popular tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS
Popular keywords
HOW TO Swimlane in Visio Visio sort key Pen and Touch Creating groups in Windows Server Raid in Windows Server Exchange 2010 maintenance Exchange server mail enabled groups Debugging Tools Collaborating
Top 10
- Microsoft Excel : How to Use the VLookUp Function
- Fix and Tweak Graphics and Video (part 3) : How to Fix : My Screen Is Sluggish - Adjust Hardware Acceleration
- Fix and Tweak Graphics and Video (part 2) : How to Fix : Text on My Screen Is Too Small
- Fix and Tweak Graphics and Video (part 1) : How to Fix : Adjust the Resolution
- Windows Phone 8 Apps : Camera (part 4) - Adjusting Video Settings, Using the Video Light
- Windows Phone 8 Apps : Camera (part 3) - Using the Front Camera, Activating Video Mode
- Windows Phone 8 Apps : Camera (part 2) - Controlling the Camera’s Flash, Changing the Camera’s Behavior with Lenses
- Windows Phone 8 Apps : Camera (part 1) - Adjusting Photo Settings
- MDT's Client Wizard : Package Properties
- MDT's Client Wizard : Driver Properties
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro