Presentation is loading. Please wait.

Presentation is loading. Please wait.

© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 9 – Building Links,

Similar presentations


Presentation on theme: "© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 9 – Building Links,"— Presentation transcript:

1 © 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 9 – Building Links, Relationships and Indexes

2 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 2 Lesson Objectives Link external objects. Create relationships. Work with linked tables. Create and edit tables. Use referential integrity and cascade options. Modify and delete indexes.

3 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 3 Linking External Objects Exercises –Link Access Tables –Link an Excel Table –Use the Linked Table Manager

4 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 4 Link Access Tables Linked tables are located outside the database Data can be added, deleted, and modified Link Table Manager –Used to update link locations Forms and Reports can use linked tables

5 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 5 Link an Excel Table Excel data can act as a table and be linked

6 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 6 Link an Excel Table Excel data must be deciphered before being linked

7 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 7 Use the Linked Table Manager Use the Link Table Manager when linked files have been moved

8 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 8 Creating Relationships Exercises –Create a One-To-Many Relationship –Create a Many-To-Many Relationship –Use a Many-To-Many Relationship in a Query –Create a One-To-One Relationship

9 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 9 Create a One-To-Many Relationship An Invoice is an example of a form that needs a One-To-Many relationship

10 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 10 Create a One-To-Many Relationship InvoiceID is the common field

11 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 11 Create a Many-To-Many Relationship Many-To-Many will not appear in the Relationship dialog box Refers to two One-To-Many relationships where the Many side from both relationships is the same table (join table) The Join table needs a two-field primary key

12 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 12 Create a Many-To-Many Relationship The Join table needs a two-field primary key

13 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 13 Use a Many-To-Many Relationship in a Query Need three tables to form this relationship

14 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 14 Create a One-To-One Relationship The common field in both tables in the relationship are primary keys One record in each table are related Can create relationships with linked tables

15 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 15 Working with Linked Tables Exercises –Edit Data in a Linked Table –Modify the Structure of a Table –Create Linked Table Relationships –Delete a Relationship

16 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 16 Edit Data in a Linked Table Editing data in a linked table is the same as any table Linked table does not need to be open to make changes

17 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 17 Modify the Structure of a Table Changes to the structure of a linked table is impossible To change the structure of a linked table you must open the database where the linked table is located

18 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 18 Create Linked Table Relationships Linked tables appear in the Relationship window like all local tables Relationships are stored only in the databases where they were created

19 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 19 Delete a Relationship Right-click the join line between two tables and select Delete to remove the relationship

20 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 20 Creating and Editing Joins Exercises –Create and Edit Joins in a Query –Create and Edit a Global Join

21 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 21 Create and Edit Joins in a Query Join Types –Inner join Displays records that have the same value in both tables Most common –Left Outer join Shows all records from the left recordset even if there are no matches in the right recordset –Right Outer join Shows all records from the right recordset even if there are no matches in the left recordset

22 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 22 Create and Edit Joins in a Query Relationships created in –The Relationship window are known as Global joins Relationship is available any where in the database –A query are known as local joins Only available in the query

23 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 23 Create and Edit Joins in a Query A Cartesian result occurs when there is no relationship (join line) between two tables in a query Query will result in all possible combinations of data This data is not useful

24 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 24 Create and Edit Joins in a Query Using join types 2 and 3 can help you find data that is missing in one of the tables

25 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 25 Create and Edit a Global Join Global joins help maintain database normalization When two tables with a relationship are used in a query, the join line will appear automatically

26 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 26 Using Referential Integrity and Cascade Options Exercises –Enforce and Test Referential Integrity –Enable Cascade Update Related Fields –Enable Cascade Delete Related Records

27 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 27 Enforce and Test Referential Integrity Referential Integrity –A set of rules –Reduces human error –Controls how data is entered and deleted Can enable referential integrity for two tables if: –The common field has the same data type –The tables are in the same database –The common field in one table is a primary key

28 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 28 Enforce and Test Referential Integrity When referential integrity is set, the “1” and “∞” are visible on the join line

29 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 29 Enforce and Test Referential Integrity Adding data that violates the referential integrity rules will not be allowed

30 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 30 Enable Cascade Update Related Fields Cascade Update option –Allows data to be changed in one common field and it is changed automatically on the other side of the relationship

31 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 31 Enable Cascade Delete Related Records Cascade Delete option –Allows records to be deleted in the “One” side of the relationship and all matching records in the “Many” side will automatically be delete –Will destroy historical data

32 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 32 Modifying and Deleting Indexes Exercises –Delete Indexes –Create a Two-Field Index

33 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 33 Delete Indexes Indexes –Create an internal sort order –Can increase the speed of finds and sorts –Too many will slow down a database

34 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 34 Create a Two-Field Index Will speed up a sort if two fields are always being used in the sort

35 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 35 Lesson 9 Summary A major advantage of relational databases over flat databases is their ability to connect data from two or more tables. You can add, delete, and modify data through linked tables. Linked tables can originate from an Access database or Excel spreadsheet. When using the Linked Table Manager, you need to know the location of the source file to refresh links to files that have been moved. The four types of relationships that can exist between tables in a relational database are One-To-One, One-To- Many, Many-To-Many, and Indeterminate. When you create a Many-To-Many relationship, the term “Many-To-Many” does not appear in the Relationships dialog box.

36 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 36 Lesson 9 Summary You can edit data in a linked table in the same way as you would any other table in the database. You cannot change the structure of a linked table. Changes can only be made in the source file. Through the Relationships window, you can create relationships using linked tables. A join is a link between two recordsets. Join types include inner join, left outer join, and right outer join. In a query, when two tables are not joined to each other, Access displays a Cartesian product. Global joins help maintain database normalization by preventing certain errors.

37 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 37 Lesson 9 Summary Referential integrity is a set of database rules used to reduce human error such as accidental deletions. Referential integrity prevents you from changing common field values in just one table. With the Cascade Delete Related Records option enforced, deleting a record in the one-side table automatically deletes all linked records in related tables. An index is a sort order used to identify records in a table. Every time you make a change to an indexed field, Access must update the indexes to include the new information. In Access, you can use two or more fields to create a unique index.


Download ppt "© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 9 – Building Links,"

Similar presentations


Ads by Google