Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Creating relationships and enforcing referential integrity

From: Access 2010 Essential Training

Video: Creating relationships and enforcing referential integrity

Access 2010 is considered a relational database, meaning that the data is split into tables that are interconnected. In this lesson, we'll create relationships between our four tables and set the referential integrity. Start by clicking on the Database Tools tab, then on the Relationships button. Click on the Show Tables button. Then double-click each of the four tables. Now, I have a tendency to click on Add, thinking I am going to close the window. So, if you do this, it will accidentally add in a repeat of that same table.

Creating relationships and enforcing referential integrity

Access 2010 is considered a relational database, meaning that the data is split into tables that are interconnected. In this lesson, we'll create relationships between our four tables and set the referential integrity. Start by clicking on the Database Tools tab, then on the Relationships button. Click on the Show Tables button. Then double-click each of the four tables. Now, I have a tendency to click on Add, thinking I am going to close the window. So, if you do this, it will accidentally add in a repeat of that same table.

You can see the _1. Go ahead and close the Show Table button. Click on that extra table and hit the Delete button on your keyboard and it will disappear. Now, hold your cursor over the bottom edge of the Customers table until you get a double-headed arrow. Then click and drag them down so that you can see the rest of your fields, and do the same thing on the SalesReps table. So, let's start with our Customers table. One of the fields is SalesRep, and it gets that info from the SalesReps table. So, let's drag the primary key field, EmpID, from the SalesReps table and drop it on SalesReps here in the Customers table.

It brings up an Edit Relationships window showing the two: the source field and the destination field. We want to click in the check box to Enforce Referential Integrity. Then check both Cascade Update and Cascade Delete Related Records. Cascade Update means if we make any changes to the EmpID field, it will make the same changes in any other tables that use that field. In our case, if we change a SalesRep's ID, it would make the same changes in the Customer table. If we didn't check this, we could potentially find SalesReps in the Customer table that no longer existed.

Those are called orphaned records. We also have a Join Type to set. Click this button here. There are three states: Only include rows where the joined fields from both tables are equal, Include All records from SalesReps and only those records from Customers where the joined fields are equal, Include All records from Customers and only those records from SalesReps where the joined fields are equal. Now, most of the time we use the first one, but in cases where we would want to see reports that included the SalesReps, even if they didn't have any assigned Customers, we would choose the second option.

If we wanted to run reports that included all of our Customers, even if they didn't have any SalesReps, we'd choose that option. Let's go ahead and choose option number two and then click OK. Now, notice down here the One-To-Many designation, indicating that there can only be one of each rep, and that each rep can have many customers. Then click Create. You'll now see a black line running between the SalesReps table and the Customers table. There is 1 right here, indicating the one part of the relationship, and there is an infinity symbol right here, indicating the many customers that each rep might have.

Notice that line goes under the Products table. You can drag the tables and move them around to your liking. In fact, let's move SalesReps over to the left and move all of these tables over. Next, the Customers all place orders. So, let's dragged the CustID field over to the Customer field in the Orders table. Enforce Referential Integrity and Cascade Update and Delete so that if we delete a customer from the database, all of their orders will disappear too.

We don't need to adjust the Join Type. We won't ever have customers that haven't place an order, and we won't have orders without customers. Click Create, and you'll see the One-To-Many relationship. There is no arrow here, the way there is here, because we did a normal Join Type instead of a Type2. Now, let's do the same for the SKU in the Product table. Pick it up and drag it to the Product in the Orders table, Enforce Referential Integrity, but only the Cascade Update.

We don't want a Cascade Delete, because if we discontinue our product, we don't want that product's SKU to disappear out of an order. We also don't need to change the Join Type. Click Create to finish. Now, click the Close button and Access will ask to save the changes. Say Yes. Now, all of our tables are linked together and Access understands which pieces of data interrelate. Relationships will also allow us to bring data together from the different tables into our forms and reports.

Show transcript

This video is part of

Image for Access 2010 Essential Training
Access 2010 Essential Training

79 video lessons · 59674 viewers

Alicia Katz Pollock
Author

 
Expand all | Collapse all
  1. 1m 25s
    1. Welcome
      51s
    2. Using the exercise files
      34s
  2. 19m 8s
    1. Database concepts and terminology
      5m 35s
    2. Starting Access
      55s
    3. Creating a new file
      1m 10s
    4. Trusting a file
      56s
    5. The Quick Access toolbar
      1m 8s
    6. Backstage view
      2m 45s
    7. Exploring ribbons
      2m 59s
    8. Using the Navigation pane
      2m 11s
    9. Getting help
      1m 29s
  3. 23m 33s
    1. Planning and designing your database
      1m 33s
    2. Creating tables using Application Parts
      6m 48s
    3. Creating tables in Layout view with Quick Start
      3m 59s
    4. Creating and editing tables in Design view
      2m 41s
    5. Setting a primary key
      1m 20s
    6. Creating a lookup field
      3m 59s
    7. Creating multi-value fields
      2m 19s
    8. Using calculated fields
      54s
  4. 13m 5s
    1. Setting field properties
      7m 34s
    2. Setting input masks
      2m 3s
    3. Setting validation rules
      3m 28s
  5. 5m 20s
    1. Creating relationships and enforcing referential integrity
      4m 32s
    2. Viewing subdatasheets
      48s
  6. 19m 52s
    1. Entering data into your tables
      9m 44s
    2. Formatting tables
      4m 2s
    3. Finding, sorting, and filtering records
      6m 6s
  7. 29m 57s
    1. Creating data-entry forms
      2m 31s
    2. Using the Form Wizard
      1m 38s
    3. Modifying a form in Layout view
      7m 1s
    4. Using Design view
      12m 41s
    5. Setting tab stops
      1m 26s
    6. Adding buttons to a form
      1m 49s
    7. Using navigation forms
      2m 51s
  8. 26m 49s
    1. Introduction to queries
      1m 9s
    2. Using the Query Wizard
      1m 52s
    3. Creating a query in Design view with criteria
      4m 18s
    4. Creating wildcard queries
      1m 24s
    5. Creating reusable parameter queries
      1m 29s
    6. Creating yes/no queries
      1m 12s
    7. Creating "and" and "or" queries
      3m 7s
    8. Building calculation queries
      2m 44s
    9. Creating statistical queries
      3m 1s
    10. Using update queries
      2m 56s
    11. Using delete queries
      1m 31s
    12. Creating crosstab queries
      2m 6s
  9. 26m 43s
    1. Introduction to reports
      1m 28s
    2. Using the Report Wizard
      2m 0s
    3. Formatting reports in Layout view
      5m 16s
    4. Identifying report structure in Design view
      2m 30s
    5. Adding group and sort capabilities to a report
      2m 43s
    6. Adding existing fields from other tables
      1m 59s
    7. Adding totals and subtotals to a report
      2m 58s
    8. Adding conditional formatting and data bars to a report
      2m 38s
    9. Creating multi-table reports
      1m 46s
    10. Creating mailing labels
      2m 16s
    11. Printing reports
      1m 9s
  10. 4m 32s
    1. PivotTables
      2m 29s
    2. PivotCharts
      2m 3s
  11. 7m 35s
    1. Creating macros
      2m 53s
    2. Attaching macros to objects
      2m 26s
    3. Using data macros
      2m 16s
  12. 17m 10s
    1. Importing Excel and text data
      3m 39s
    2. Exporting data into Excel
      1m 0s
    3. Exporting to PDF
      53s
    4. Exporting into a Word Mail Merge
      1m 3s
    5. Publishing to a web browser in HTML or XML
      1m 51s
    6. Sharing via email
      58s
    7. Collecting data over email
      2m 42s
    8. Using Package and Sign
      1m 14s
    9. Publishing to SharePoint
      2m 59s
    10. Importing and exporting with SharePoint
      51s
  13. 6m 41s
    1. Compacting and repairing a database
      48s
    2. Using data analysis tools
      1m 4s
    3. Encrypting a database and setting a password
      2m 22s
    4. Splitting a database
      2m 27s
  14. 8m 19s
    1. Customizing the ribbons
      1m 16s
    2. Setting Access options
      7m 3s
  15. 14s
    1. Goodbye
      14s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Access 2010 Essential Training.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.