Presentation is loading. Please wait.

Presentation is loading. Please wait.

BUSINESS DRIVEN TECHNOLOGY Plug-In T5 Touring Access.

Similar presentations


Presentation on theme: "BUSINESS DRIVEN TECHNOLOGY Plug-In T5 Touring Access."— Presentation transcript:

1 BUSINESS DRIVEN TECHNOLOGY Plug-In T5 Touring Access

2 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-2 LEARNING OUTCOMES 1.Describe the primary functions of Microsoft Access 2.List and describe the steps for creating a table in Microsoft Access 3.List and describe the steps for creating relationships in Microsoft Access

3 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-3 4.List and describe the steps for creating a form in Microsoft Access 5.List and describe the steps for creating a query in Microsoft Access 6.List and describe the steps for creating a report in Microsoft Access LEARNING OUTCOMES

4 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-4 Introduction Database - maintains information about various types of objects (products), events (transactions), people (employees), and places (warehouses) Relational database model - a type of database that stores its information in the form of logically- related two-dimensional tables

5 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-5 Thus plug-in details how to build a relational database applications and it associated tools This plug-in focuses on the four basic modules of Access : 1.Tables 2.Forms 3.Queries 4.Reports Introduction

6 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-6 Creating an Access Database An Access database file contains several different types of database objects: – Saved queries for retrieving and organizing data – Forms for entering and displaying data on screen – Reports for printing table data or the results of queries

7 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-7 There are four steps in producing and using a database: 1.Define the tables in which to: 1.Store the data 2.Store the data integrity constraints (such as primary keys and validation rules) 3.Store the relationships between the tables (including enforcing referential integrity) 2.Add data to the database, either directly into the table or using a form 3.Extract information from the database using a query 4.Create a report to present the information Creating an Access Database

8 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-8 TRY IT - CREATING A NEW DATABASE To create a blank database: – Click the New toolbar button, select File, New, or pressing Ctrl + N – Click the Blank Database command in the New area of the New File task pane – Select a location to save the file and enter Slopeside Bikes for the database file name

9 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-9 TRY IT - CREATING A NEW DATABASE

10 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-10 SAVING A DATABASES IN ACCESS Access is saved different from typical Office documents: – When the data is added, changed, or deleted — Access automatically saves the changes – Due to automatic data-saving feature, when a new database is created, Access saves it to a file before starting work

11 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-11 USING THE DATABASE WINDOW AND OBJECT VIEWS Whenever a database is open, Access displays the Database window – This serves as the central location for working with the database objects (tables, queries, forms, reports, etc.)

12 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-12 Important ways to work with database objects: – Click the corresponding object button in the left column of the Database window Tables, Queries, Forms, Reports – To view a database object, select it and then click the Open button – To change the design of a database object, select it and click the Design View button – To create a new database object of the type currently displayed in the Database window, click the New button New Table, New Query, New Form, New Report USING THE DATABASE WINDOW AND OBJECT VIEWS

13 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-13 Important ways to work with database objects cont…: – To make a copy of a database object, right-click it and choose Copy from the shortcut menu Right-click a blank spot in the Database window and choose Paste from the shortcut menu – To rename a database object, select it and press F2 – To delete a database object, select it and press the Delete key – To close the current database click the Close button in the upper-right corner of the window USING THE DATABASE WINDOW AND OBJECT VIEWS

14 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-14 Designing a Database Use the Design view to define the design of a new blank table Design view is used to: – Add, remove, or rearrange fields – Define the name, the data type, and other properties of each field – Designate a primary key for the table

15 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-15 CREATE A TABLE To create a new, blank table in Design view and to add fields and properties, select the Table object, click the Design button

16 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-16 Adding a Field To add a new field to a table at the end of the list, click in the Field Name column of the first blank row in the field list There are up to 64 characters for the field name, including spaces

17 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-17 Setting the Field Properties Each of the fields in a table is described by a set of properties The field's properties determine how the field's data is stored, handled, or displayed The properties include: – The field name – The data type – The description – Field size – Format – Validation rule – Caption

18 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-18 Setting the Data Type Every field is assigned a specific data type The default data type of a new field is Text To change a field's data type, click in the Data Type column for that field, and select a new Data Type from the drop-down list

19 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-19 Setting the Field Properties

20 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-20 Field Size Property The Field Size property controls the amount of space that is allocated for a particular field – Available only for a field that has the Text or Number Data Type – For a Text field, the Field Size specifies the maximum number of characters A value between 1 and 255, the default value is 50 – For a Number field, select a value from the drop-down list

21 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-21 Format Property The Format property determines how the data is displayed on the screen or how it is printed – Example: For a field that has the Date/Time data type, choose: – Long Date to display the date as Saturday, January 1, 2005 – Short Date to display a date as 1/1/2005

22 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-22 Decimal Places Property The Decimal Places property sets the number of decimal places for a field that has the Number or Currency data type – It affects only the way the number is displayed – Choose a specific number of decimal places from the drop-down list

23 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-23 Input Mask Property An Input Mask assists in entering valid data into a field – It displays placeholder characters displaying the number of characters that need to be entered – It includes separator characters such as the parenthesis and dash in a telephone number so they do not have to be typed

24 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-24 Caption Property Use the Caption property to label the field in Datasheet view, at the top of the field's column – If the Caption box is left empty (the default value), Access labels the field using the field name

25 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-25 Default Value Property When creating a database in which a field contains the same value that can be assigned to the Default Value property (by default, this property is blank) – Example: The City field in an address database in which most of the addresses are in the same city (e.g., Denver)

26 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-26 Validation Rule A Validation Rule is an expression that can precisely define the set of values accepted in a field – Example: A validation rule can be used on a field containing the date an employee was hired to prevent a date in the future from being entered

27 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-27 Validation Text The V alidation Text property sets the message displayed if the Validation Rule is rejected – Example: Such as “Area code must be 303 or 720”

28 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-28 Required Property If the Required property box is set to “Yes,” Access will require that a value be entered into the field when the record is created or modified If the property box is set to “No” (the default value), the field can be left empty

29 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-29 Indexed Property The Indexed property controls whether a field is indexed Indexing a field significantly speeds up searching, sorting, or running queries on that field – It requires more space for storing the information – It can make adding, deleting, or updating records slower The primary key for a table is automatically indexed

30 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-30 Smart Tags Smart tags provide a way to integrate an Access database with other applications – Since Access cannot recognize smart tags dynamically, a smart tag for a field or control needs to be defined – The smart tag will be available regardless of the contents of the field or control – Smart tags are similar to hyperlinks

31 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-31 DESIGNATING A PRIMARY KEY The primary key consists of one or more fields that Access can use to uniquely identify the records contained within the table A table must have a primary key if it is on the “one” side of a one-to-many relationship To designate a field as the primary key, select the field, click the Primary Key toolbar button

32 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-32 DESIGNATING A PRIMARY KEY

33 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-33 Try IT – Build Tables In the left column of the Database window, make sure that the Tables object is selected Click Design on the Database dialog box Create fields for the following: – Field Name = BikeID, Data Type = Number, Field Size = Long Integer, Primary Key – Field Name = Description, Data Type = Text, Field Size = 25 – Field Name = CostPerHour, Data Type = Currency Close the Tables dialog box, and click Yes to Save the changes Enter Bikes as the Table name

34 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-34 Create fields for each entry below, using field sizes and descriptions as appropriate Try IT – Build Tables

35 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-35 Close the Tables dialog box, and click Yes to Save the changes Enter Customers as the Table name Create fields for each entry below Try IT – Build Tables

36 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-36 Close the Tables dialog box, and click Yes to Save the changes Enter Rentals for the Table name Try IT – Build Tables

37 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-37 SETTING UP TABLE RELATIONSHIPS Relationships between associated tables must be explicitly defined The required relationships must explicitly be defined before Access can combine the related data

38 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-38 Referential integrity – states that every non-null foreign key value must match an existing primary key value When one table has a foreign key to another table, the concept of referential integrity states that a record to the table that contains the foreign key can not be added unless there is a corresponding record in the linked table SETTING UP TABLE RELATIONSHIPS

39 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-39 Try IT – Create Relationships Open the Relationships window by choosing Tools, Relationships Select each table listed (i.e., Bikes, Customers, and Rentals ) and click the Add button To define a new relationship, click and drag the BikeID from the Bikes table and drop it on the BikeID in the Rentals table Click the Create button in the Edit Relationships dialog box that Access shows Select the Enforce Referential Integrity box Close the Relationships window, and Save the layout

40 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-40 Try IT – Create Relationships

41 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-41 Complete the diagram with the Relationships shown below Try IT – Create Relationships

42 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-42 Creating Forms And Data Access Pages An Access form is a window that contains a set of controls to view, enter, or edit database information, typically one record at a time – Data is obtained directly from one or more tables or data that has been extracted using a query

43 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-43 TRY IT - CREATE A FORM USING THE FORM WIZARD In the left column of the Database window, make sure that the Forms object is selected Click New on the Database dialog box In the New Form dialog box, select the Form Wizard option and click the OK button – The Form Wizard will start running In the first Form Wizard dialog box, select all the fields needed to display on the form

44 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-44 TRY IT - CREATE A FORM USING THE FORM WIZARD

45 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-45 Select the Bike table from the Tables/Query drop down list Move all the Available Fields, BikeID, Description, CostPerHour, from the Available Fields list to the Selected Fields lists Click the Next button In the second Form Wizard dialog box, select the Columnar radio button TRY IT - CREATE A FORM USING THE FORM WIZARD

46 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-46 TRY IT - CREATE A FORM USING THE FORM WIZARD

47 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-47 Click the Next button In the third Form Wizard dialog box, select the Standard style – This style affects the background color or pattern, the fonts, the look of the controls, and other features of the form TRY IT - CREATE A FORM USING THE FORM WIZARD

48 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-48 TRY IT - CREATE A FORM USING THE FORM WIZARD

49 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-49 Click the Next button to open the final wizard dialog box In the final Form Wizard dialog box, the Bike table name is inserted into the title text box – This assigns a name to the form and chooses the way the form will initially be opened Click the Finish button to have Access create the form TRY IT - CREATE A FORM USING THE FORM WIZARD

50 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-50 TRY IT - CREATE A FORM USING THE FORM WIZARD

51 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-51 TRY IT - CREATE A FORM USING THE FORM WIZARD

52 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-52 Using the Bike form, type in the information displayed below TRY IT - CREATE A FORM USING THE FORM WIZARD

53 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-53 Create a new form and populate the new form from the Customer table using the information displayed below TRY IT - CREATE A FORM USING THE FORM WIZARD

54 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-54 Use the information displayed below to create a new form and populate the new form from the Rental table TRY IT - CREATE A FORM USING THE FORM WIZARD

55 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-55 Creating A Query A query is a tool for extracting, combining, and displaying data from one or more tables, according to any criteria specified. Information is sorted, summarized (e.g., totals, averages, counts), and displayed according to sort criteria and/or results of calculations on data The results of a query can be viewed in a tabular format

56 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-56 Creating A Query

57 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-57 Try IT – Create A Query In the left column of the Database window, select the Queries object Click New on the Database dialog box, then select the Simple Query Wizard option in the New Query dialog box and click the OK button In the first Simple Query Wizard dialog box, select the LastName, Firstname, and City from the Customers table to include in the query

58 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-58 Move these fields from the Available Fields list to the Selected Fields list Repeat this operation to include the BikeID from the Bike table and the Date and Damage? fields from the Rental table Try IT – Create A Query

59 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-59 Try IT – Create A Query

60 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-60 Click the Next button to open the second wizard dialog box When one or more numeric fields have been selected in addition to the primary key Access will display the second Simple Query Wizard dialog box Try IT – Create A Query

61 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-61 Try IT – Create A Query

62 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-62 If a numeric field in the first dialog box is not selected, the wizard will immediately display the final dialog box Select the type of query: – To show the information on the query from every matching record, select Detail – To display summary information from each group of matching records, rather than showing the information from all matching records, select Summary Try IT – Create A Query

63 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-63 Try IT – Create A Query

64 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-64 Click the Next button In the final Simple Query Wizard dialog box, enter Damaged Bike Query for a query title in the text box Try IT – Create A Query

65 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-65 Select the Open the query to view information option to open the query in the Datasheet view Click the Finish button to proceed Try IT – Create A Query

66 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-66 MODIFYING A QUERY The Design view is used to define a new query, customize a new query, or modify an existing query of any type

67 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-67 Try IT – Modify a Query Open the Damaged Bikes Query in Design View Select the City column, right mouse click and click Cut Change the BikeID field and select Description Select the Damaged? Field, right mouse click and click Cut Select an empty column, type in Rental Amount: ([Time In]-[Time Out])*24*[CostPerHour] in the field row Run the modified Query, by clicking on the Run button (i.e., the red exclamation mark) on the tool bar

68 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-68 Try IT – Modify a Query

69 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-69 Generating Reports Reports are used primarily for printing selected database information A report labels, groups, sorts, and summarizes the data it presents

70 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-70 Generating Reports

71 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-71 TRY IT - USE THE REPORT WIZARD In the left column of the Database window, make sure that the Reports object is selected Click New on the Database dialog box Select the Report Wizard option in the New Report dialog box and click the OK button In the first Report Wizard dialog box, select the query that was created in the previous section, Bike Rental Report, to be included in the report Move from the Available Fields to the Selected Fields, Description, Date, Last Name, First Name, and Rental Amount

72 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-72 Make sure to move them in the order that is written, as shown below TRY IT - USE THE REPORT WIZARD

73 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-73 Click the Next button to open the next Report Wizard dialog box Selecting fields from more than one table or query in the previous step will enable the second Report Wizard dialog box to appear Choose the Description field for grouping the information in the report Click the Next button In the third Report Wizard dialog box, choose Date for the sorting order for the Detail section in the report TRY IT - USE THE REPORT WIZARD

74 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-74 TRY IT - USE THE REPORT WIZARD

75 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-75 Click the Summary Options button – The Summary Options dialog box opens – This dialog box lists each of the numeric or currency fields included in the report's Detail section – Access can summarize the values in one or more of these fields for each group in the report – Check the Sum box for the Rental Amount TRY IT - USE THE REPORT WIZARD

76 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-76 TRY IT - USE THE REPORT WIZARD

77 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-77 Click OK to return to the third Report Wizard dialog box The fourth Report Wizard dialog box sets the report's layout and orientation – Select the Stepped option, the model at the left of the dialog box gives an idea of how the report will look Click the Next button to go to the fifth dialog box The fifth dialog box of the Report Wizard formats the style for the report – Select the Bold style TRY IT - USE THE REPORT WIZARD

78 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-78 Click the Next button In the sixth and final Report Wizard dialog box name the report and choose whether to immediately preview the report's printed appearance or open it in Design view to modify its design – Type in Slopeside Bike Rental Report in the tile text box and click the Preview the report button Click the Finish button to generate and open the report TRY IT - USE THE REPORT WIZARD

79 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-79 TRY IT - USE THE REPORT WIZARD

80 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-80 MODIFYING A REPORT The Design view is used to: – Add, remove, or modify the controls that make up a report – Work with report sections – Change the properties of the report itself

81 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-81 Try IT - Modify a Report In the left column of the Database window, make sure that the Reports object is selected Click Design on the Database dialog box Under the Detail section, right mouse click on the Rental Amount box, select Properties, click on the Format tab, select the Format text box, click on the drop down arrow and select Currency Close the Text box

82 McGraw-Hill/Irwin © 2006 The McGraw-Hill Companies, Inc. All rights reserved. 5-82 Repeat the same functions from step three and four for the =Sum text box under the Description Footer and the =Sum text box under the Report Footer Close the Text Box Click View on the toolbar and then select Print Preview To return to the Design view, click View on the toolbar and then select Design Make any other needed modifications in order to match the report in Figure T5.27 Try IT - Modify a Report


Download ppt "BUSINESS DRIVEN TECHNOLOGY Plug-In T5 Touring Access."

Similar presentations


Ads by Google