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 6 – Designing.

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 6 – Designing."— 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 6 – Designing Queries

2 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 2 Lesson Objectives Create and modify select queries. Add Criteria and operators to a query. Apply logical operators. Modify query properties. Add calculations to a query. Create queries with Wizards. Apply PivotChart/PivotTable Views.

3 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 3 Creating and Modifying Select Queries Exercises –View a Select Query and its Reports –Create a Select Query Based on a Single Table –Add Fields to a Query –Create a Select Query Based on Two Tables

4 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 4 View a Select Query and its Reports Many forms and reports use select queries to reduce the number of records

5 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 5 View a Select Query and its Reports The source of a report’s record can be found in the Property Sheet, Data tab, in the Record Source property

6 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 6 Create a Select Query Based on a Single Table Fields and criteria are added in the Design view of a query

7 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 7 Add Fields to a Query Add a field to a query by –Double- clicking the field in the Field List –Drag a field from the Field List –On the Field row, use the drop-down arrow

8 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 8 Create a Select Query Based on Two Tables Queries can use more than one recordset All recordsets in a query must be linked with each other

9 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 9 Adding Criteria and Operators to a Query Exercises –Use a Single Criterion –Use Comparison Operators –Use Wildcards in Criteria –Use Keywords in Criteria

10 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 10 Use a Single Criterion Conditions –Can be a function Uses arguments to pass data to the functions –Operators

11 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 11 Use a Single Criterion Criterion can be –Dates Adds “#” around the dates –Numbers –Expression –Text

12 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 12 Use Comparison Operators Comparison operators are used to evaluate data The evaluation must be true for the record to be included into the dynaset

13 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 13 Use Wildcards in Criteria Wildcards mean the same as they did when using the Find command The keyword “Like” is added when using a wildcard

14 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 14 Use Wildcards in Criteria Example of a criteria with wildcards

15 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 15 Use Keywords in Criteria “Like” is added automatically Other keywords must be keyed be hand

16 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 16 Applying Logical Operators Exercises –Use the “AND” Criterion –Use the “OR” Criterion

17 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 17 Use the “AND” Criterion The “AND” condition can be created for one or many fields Criteria on the same row

18 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 18 Use the “OR” Criterion The “AND” condition can be created for one or many fields Criteria on the different rows

19 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 19 Modifying Query Properties Exercises –Find the Top and Bottom Values –Create a query with a Subdatasheet

20 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 20 Find the Top and Bottom Values The Top Value property will find the records based on the sorted field

21 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 21 Create a Query with a Subdatasheet Query datasheet views can have subdatasheet added just like tables Query property called Subdatasheet Name

22 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 22 Adding Calculations to a Query Exercises –Use a Formula in a Calculated Field –Use a Function in a Calculated Field

23 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 23 Use a Formula in a Calculated Field Calculated fields do not store data Each calculation must have a unique name Expression Builder is used to create calculations

24 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 24 Use a Formula in a Calculated Field Parts of the Expression Builder

25 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 25 Use a Formula in a Calculated Field In the Expression Builder, fields appear in square bracket

26 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 26 Use a Function in a Calculated Field The Expression Builder can be used to create Functions The function DataDiff has three arguments

27 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 27 Creating Queries with Wizards Exercises –Use the Simple Query Wizard –Use the Crosstab Query Wizard –Use the Find Duplicates Query Wizard –Use the Find Unmatched Query Wizard

28 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 28 Use the Simple Query Wizard The wizard allows you to select from all recordsets as long as they are related

29 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 29 Use the Crosstab Query Wizard Displays data like a spreadsheet User defines which fields are used for –Data –Column Headers –Row Headers

30 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 30 Use the Find Duplicates Query Wizard This query analyzes a table to see if a table had repeated data is a field Users must define the field to be changed

31 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 31 Use the Find Unmatched Query Wizard Finds orphaned records Can delete found records

32 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 32 Applying PivotChart/PivotTable Views Exercises –Use PivotTable View –Use PivotChart View

33 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 33 Use PivotTable View Summarizes data in an interactive table Drag and drop fields into the Drop Zones

34 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 34 Use PivotChart View Summarizes data in an interactive chart Displays information like a crosstab query More than one field can be added to a drop zone Priority from left to right

35 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 35 Use PivotChart View Each field button can be set to include some or all values in the field

36 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 36 Lesson 6 Summary Only a single filter can be saved per table, but multiple queries can be associated to a single table. A select query, the most common type of query, locates data from one or more tables and displays the results as a datasheet. The Query Design window has an upper and lower pane. The upper pane is the Field List pane in which you choose the data source from one or more Field Lists. The lower pane is the design grid in which you specify criteria. A dynaset is dynamic recordset that automatically reflects changes to its underlying data source. In the design grid of a query, the check box in the Show row indicates that the field will display in the Datasheet View.

37 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 37 Lesson 6 Summary When two or more tables are used in a query, the tables must be linked through a common field. In a query, more than one condition can be placed on multiple fields. An operator is a word or symbol that indicates a specific arithmetic or logical relationship between the elements of an expression. Operators can include arithmetic operators, comparison operators, logical operators, concatenation operators, and special operators. A function is a procedure used in an expression. An argument is a reference in a function assigned as a single variable.

38 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 38 Lesson 6 Summary Criterion using text values include leading and closing quotation marks. Criterion using date values include leading and closing pound signs (#). Numbers and expressions do not require leading or closing symbols. When using a wildcard in the Criteria row of a query, the “Like” operator compares the criterion condition to each record. Only the keyword “Like” is automatically added to a criterion. All other keywords must be specified. Criterion expressions can be viewed in the Zoom box. You can open the Zoom box by pressing [Shift]+[F2]. An AND criterion exists when two conditions must occur simultaneously for the statement to be true.

39 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 39 Lesson 6 Summary An OR criterion exists when one of two conditions must occur for the statement to be true. When using the Top Values property, Access displays records based upon the defined sort order. The Top Values property displays either a static number of records (such as the top five) or a percentage of all records in the dynaset (such as the top 5%). A calculated field is a field that uses an expression or formula as its data source. When a field does not have a name, Access assigns an alias name. The alias name for a calculated field displays as text followed by a colon. The Find Duplicates Query Wizard analyzes a table for duplicate data.

40 THE PROFESSIONAL APPROACH SERIES © 2008 The McGraw-Hill Companies, Inc. All rights reserved. 40 Lesson 6 Summary Calculated fields can be entered directly into the design grid or can be entered using the Expression Builder. The Expression Builder is an interface used to create a function, calculation, or expression. A crosstab query displays information similar to a spreadsheet. Crosstab queries require that you have data suitable for summarizing. Many tables do not have fields appropriate to display as a crosstab. The Find Unmatched Query Wizard finds unmatched, or orphaned, records. A PivotTable is an interactive table that combines and compares data in a summarized view. A PivotChart is an interactive graphical representation of data displayed in a PivotTable.


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 6 – Designing."

Similar presentations


Ads by Google