Presentation is loading. Please wait.

Presentation is loading. Please wait.

© 2001 ComputerPREP, Inc. All rights reserved. Access 2000: Module II.

Similar presentations


Presentation on theme: "© 2001 ComputerPREP, Inc. All rights reserved. Access 2000: Module II."— Presentation transcript:

1 © 2001 ComputerPREP, Inc. All rights reserved. Access 2000: Module II

2 © 2001 ComputerPREP, Inc. All rights reserved. Lesson 2: Creating Relational Databases

3 Objectives Describe table relationships Relate tables Enforce referential integrity Print table relationships

4 Examining Table Relationships Relational database – a database that contains multiple tables related through common fields Relationship – a connection between two or more tables based on a common field By creating table relationships, you can: –View and work with data stored in multiple tables –Create queries and reports that display data from related tables –Create forms to enter and view information stored in related tables

5 Examining Table Relationships (cont’d) Key components that allow a relationship to work: –Common field – a field contained in two or more tables that forms a connection between the tables –Primary key – a field containing a value that uniquely identifies each record –Foreign key – a field in a related table that refers to the primary key in another table

6 Examining Table Relationships (cont’d) Three types of relationships can be established between tables: –One-to-one – each record in Table A has only one matching record in Table B, and vice versa –One-to-many – a record in Table A has many matching records in Table B; a record in Table B has only one matching record in Table A –Many-to-many – a record in Table A or Table B has many matching records in the other table

7 Examining Table Relationships (cont’d) A one-to-many relationship is the most common table relationship A one-to-one relationship (which is very uncommon) can be used to: –Divide an extremely large table –Isolate part of a table for security reasons –Store information that applies only to a subset of the main table A many-to-many relationship is established by creating two one-to-many relationships with a junction table

8 Relating Tables Use the Table Wizard or the Relationships window to create table relationships The Table Wizard displays a series of dialog boxes in which you enter selections for a new table To relate tables in the Relationships window: –Click the common field in the primary table (the primary key) –Drag it to the common field in the related table (the foreign key)

9 Enforcing Referential Integrity Referential integrity – rules to ensure relationships between records in related tables are valid Override rules against changing or deleting records and still maintain referential integrity by enabling: –Cascade Update Related Fields – changing the primary key value in the primary table updates the matching value in all related records –Cascade Delete Related Records – deleting a record in the primary table deletes all related records in the related table

10 Printing Table Relationships You can print table relationships using the Documenter window The Documenter window is accessible from: –Within a table –The database window –The Relationships window

11 © 2001 ComputerPREP, Inc. All rights reserved. Lesson 3: Working with Related Tables

12 Objectives Use the Lookup Wizard Modify lookup fields Add data to related tables Use subdatasheets

13 About Working with Related Tables Data you enter into related fields must match the data in one or more related tables Access offers two techniques to display data from related tables in datasheet view: –Lookup field – a combo box that displays a list of values from a related table –Subdatasheet – a small datasheet, which is part of the primary table’s datasheet, and displays information from a related table

14 Using the Lookup Wizard You use the Lookup Wizard to create lookup fields and value lists When you create a lookup field, a relationship is established between two tables You can modify a lookup field’s properties by setting its properties in the Lookup card of the table Design window A value list is a static list of values that display in a drop-down list

15 Modifying Lookup Fields Display the Lookup card in the Field Properties section of the table Design window Lookup field properties determine: –Which value is stored in the lookup field –What displays in the lookup field drop-down list

16 Adding Data to Related Tables You can use lookup fields and value lists to add data to related tables To add data using lookup fields and value lists: –Display the lookup field drop-down list that contains values from the related table, or display the value list drop-down list –Select the desired data Any updates you make to the table containing the primary key values will be reflected in the lookup field

17 Using Subdatasheets You can insert, remove, expand, collapse and print subdatasheets Add data in a related table by: –Clicking the plus sign (+) to expand the subdatasheet –Entering information –Clicking the minus sign (-) to collapse the subdatasheet

18 © 2001 ComputerPREP, Inc. All rights reserved. Lesson 4: Using Subforms

19 Objectives Create subforms Display information with subforms Add records to a table using subforms

20 About Subforms Subform – a form embedded within another form Subforms display data from tables or queries that have a one-to-many relationship with the record displayed in the main form The main form and the subform are linked by the foreign key field The subform displays only records that relate to the record currently displayed in the main form

21 Creating Subforms A form can have any number of subforms You can nest as many as ten levels of subforms You can specify more than one table as the record source for a form or subform Create subforms by: –Using the Form Wizard as you create a new form –Using the SubForm Wizard –Using the Subform button in the Toolbox –Using the drag-and-drop technique

22 Creating Subforms (cont’d) Using the SubForm Wizard: –Access automatically links the main form and the subform if the linking fields have the same kind of data, data type or field size –The linking fields do not have to appear in the main form or subform Using the drag and drop technique: –The main form and the form to be used as the subform must exist in the Forms object list

23 Displaying Information with Subforms You can display a subform as a: –Datasheet – multiple records, one line per record –Single form – one record –Continuous form – multiple records You can view a subform in: –Datasheet view –Form view You can change the layout of a subform in: –Datasheet view –Form view –Design view

24 Adding Records to a Table Using Subforms When you enter data into the main form: –The data is automatically saved to the primary table as you move to the subform When you enter data into the subform: –The data is automatically saved to the foreign table as you add the new record

25 © 2001 ComputerPREP, Inc. All rights reserved. Lesson 5: Maintaining Data Integrity

26 Objectives Review field properties Use input masks Set required properties Use validation rules

27 Reviewing Field Properties Every field has properties Properties are different depending on the field type Properties that display for a given field are determined by the field’s data type Field properties can have overlapping effects

28 Using Input Masks Input Mask – determines what kind of data and how many characters you can enter into a field Input Masks have three sections: –The input mask itself –A character that determines whether or not literal characters are stored within the data –The placeholder character Create input masks by: –Using the Input Mask Wizard, or –Typing in the Input Mask text box in the Field Properties section of the table Design window

29 Setting Required Properties Setting the Required property ensures that users enter data for a field If a field is a primary key field, data must be entered whether or not the Required property is set If the Required property is enforced at the table level; data is validated when entered: –In the table –In forms –In datasheets based on the table

30 Using Validation Rules You can set validation rules for fields and records Set validation rules in table Design view so they will apply in both Datasheet and Form views A field validation rule is used to check the value entered into a field during data entry A record validation rule controls when an entire record can be saved –Record validation rules, unlike field validation rules, can refer to other fields in the same table

31 © 2001 ComputerPREP, Inc. All rights reserved. Lesson 6: Using Advanced Form Features

32 Objectives Add pictures to records Use calculated controls Improve accuracy in forms

33 Reviewing Form Controls Bound control – a control that displays data from the form’s underlying table or query Unbound control – a control that is not tied to fields in an underlying table or query –Examples of unbound controls – labels, text boxes, option buttons, command buttons and lines Calculated control – an unbound control that calculates values in a form, such as totals, averages and so forth

34 Adding Pictures to Records Bound object frame – a bound control you use to display a bound object, such as a photograph, which is tied to a record in a table To add pictures to a record: –Add a field with the OLE Object data type –Add a graphic file to the OLE Object field for a given record –Insert a bound object frame into a form to display the graphic

35 Using Calculated Controls To create a calculated control: –Insert an unbound text box control into a form –Display the Data properties for the unbound text box control –Type an expression in the Control Source text box or –Use the Expression Builder to build an expression in the Control Source text box

36 Reviewing the Syntax of an Expression Use an identifier to refer to an object or its properties The identifiers Forms and Reports refer to the open forms or reports in the database The ! operator indicates that the object which follows is a user-defined object Examples: –Forms![Vehicles] refers to the Vehicles form –Forms![Vehicles]![Cost] refers to the Cost field in the Vehicles form

37 Improving Accuracy in Forms Use the built-in shortcut key CTRL+’ to insert the value from a field in one record into the same field in the next record Set the tab order so that the insertion point moves from field to field in an orderly manner as you add data to a form Exclude controls from the tab order for controls that should not be used in data entry, such as calculated controls

38 © 2001 ComputerPREP, Inc. All rights reserved. Lesson 7: Using Advanced Report Features

39 Objectives Create a report using the Report Wizard Customize headers and footers Concatenate text fields Add calculated values Force pagination Work with subreports

40 Creating a Report Using the Report Wizard The Report Wizard presents a series of dialog boxes that guide you step by step through the creation of a new report You can specify: –The tables and queries to use as data sources –The fields to include in the report –How to group the data –The order in which the records appear within each group –The page layout and orientation

41 Customizing Headers and Footers Customize header and footer sections by: –Adding bound, unbound and calculated controls –Opening, closing and resizing report sections –Adding page numbers and time and date stamps Page numbers and time and date stamps are found on the Insert menu in report Design view Page and report headers and footers must be added in pairs If you do not want a header or footer to display, close its section

42 Concatenating Text Fields Concatenating text fields combines text values from multiple fields and displays it as a continuous string Use the ampersand (&) operator in an expression to concatenate values from text fields Concatenated fields: –Occupy less room in a report –Are generally easier to read than separate fields

43 Adding Calculated Values If you use the Report Wizard to create a report, you can group information and perform calculations, such as subtotals and averages, for each group You can also create calculated controls in Design view

44 Forcing Pagination Using page breaks: –In report Design view, click the Page Break button in the Toolbox –Click in the desired report section Using the ForceNewPage property: –In report Design view, display the All properties for the section –In the Force New Page text box, select a property setting from the drop-down list

45 Working with Subreports Subreport – a report that is inserted into another report, called the main report The subreport control must be linked to the main report in order for the report to be synchronized Use the Subreport Field Linker dialog box to link reports that are not automatically linked because: –The tables/queries are not part of a defined relationship –The main report is not based on a primary table/query and the subreport is not based on a foreign table/query

46 © 2001 ComputerPREP, Inc. All rights reserved. Lesson 8: Using Advanced Query Features

47 Objectives Join tables in a query Perform calculations in a query Display special records

48 Joining Tables in a Query If tables are related, they will automatically be joined by their common fields in the query Design window If tables are unrelated, you will have to join them in the query Design window –Joining unrelated tables applies to tables only for the current query; it does not create a permanent join Two join types: –Inner join – displays rows where joined fields from both tables are equal –Outer join – displays all rows from one table and only matching rows from the other table

49 Performing Calculations in a Query You can add calculated fields to a query that are not part of an underlying table To perform a calculation in a query: –Use totals, or –Use custom calculations you define Total – a pre-defined expression that calculates a specific value from table data –Use totals to compute the sum, average, count, minimum, maximum, standard deviation or variance for records

50 Performing Calculations in a Query (cont’d) To perform more than one calculation for a particular field, duplicate the field as many times as necessary in the query design grid To perform a custom calculation, create a calculated field in the query design grid –Calculated field – a field defined in a query that displays the result of an expression rather than data stored in a table

51 Displaying Special Records You can design queries that display: –Records containing unique values –Records based on whether or not they contain values in a specified field You can use two expressions to select records based on whether or not they contain values: –Is Not Null – used to select records that contain values in a specified field –Is Null – used to select records that do not contain values in a specified field

52 © 2001 ComputerPREP, Inc. All rights reserved. Lesson 9: Using Advanced Queries

53 Objectives Use crosstab queries Use parameter queries Use action queries Optimize queries using indexes

54 Using Crosstab Queries Crosstab query – a query that displays summarized values in a table format Crosstab queries contain rows, columns and summary fields –Summary fields display at row/column intersections and display values calculated using a summary function (average, count, sum and so forth)

55 Using Parameter Queries Parameter query – a query that prompts the user for specific criteria every time the query is executed Specify the order of parameters in the Query Parameters dialog box –The parameter order controls the order in which the prompts display when the parameter query is executed

56 Using Action Queries The four types of action queries are: –Append query – a query that adds a group of records from a table at the end of another table –Delete query – a query that deletes records from a table –Make-table query – a query that creates a new table from all or part of the data in an existing table –Update query – a query that makes global changes to a group of records in a table

57 Using an Update Query Use an update query to make changes to multiple records in one operation To create an update query: –Create a select query –Convert the select query to an update query –Run the update query –Check the results by converting the update query back to a select query and running it

58 Using a Make-Table Query Use a make-table query to create a new table from all or part of the data in an existing table Make-table queries are helpful for: –Creating a table to export to another database –Creating a table to show information from a specific point in time forward –Creating a backup copy of a table –Creating a history table that contains old records

59 Using an Append Query Use an append query to add records from one table to another table The following rules apply to append queries: –If the existing table has a primary key field, the records you add cannot contain Null values or duplicate primary key values of records already existing in the table –The table to which you will add records must exist –If you use the asterisk (*) field, you cannot also use individual fields from the same table –If the appended records have an AutoNumber field, do not include an AutoNumber field in the design grid if the existing table has an AutoNumber field as the primary key field

60 Using a Delete Query Use a delete query to delete records from tables To delete records from multiple tables, do the following: –Define relationships between the tables –Turn on Enforce Referential Integrity for the joins between tables –Turn on the Cascade Delete Related Records option for the joins between tables

61 Optimizing Queries Using Indexes Index – a feature that helps Access search, find and sort records You can optimize the performance of a query by: –Indexing any field used to set criteria for the query –Indexing fields on both sides of a join

62 © 2001 ComputerPREP, Inc. All rights reserved. Lesson 10: Working with Charts

63 Objectives Create charts Customize charts

64 Creating Charts Chart – a graphical representation of numerical information that you can use in a report, form or data access page You can use the Chart Wizard to create a chart based on an existing table or query A few basic rules when working with charts: –Select the fields containing the data to be charted –Include the fields containing the labels that identify the data –Include any linking fields if you want the data to change from record to record

65 Customizing Charts To customize a chart, double-click on the chart in Design view to open Microsoft Graph 2000 Microsoft Graph 2000 displays two windows: –Datasheet window – spreadsheet of the data used in the graph –Chart window – displays the chart You can change data in the datasheet window to make temporary changes to a chart You must change data in the underlying table or query to make permanent changes to a chart

66 Customizing Charts (cont’d ) Use the chart window to customize charts Cosmetic changes you can make include: –Changing the chart size –Changing the text attributes –Modifying chart objects with colors and patterns –Moving and modifying the chart legend –Changing the chart type


Download ppt "© 2001 ComputerPREP, Inc. All rights reserved. Access 2000: Module II."

Similar presentations


Ads by Google