access chapter 02
DESCRIPTION
TRANSCRIPT
![Page 1: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/1.jpg)
MicrosoftAccess 2013
Chapter 2
Querying a Database
![Page 2: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/2.jpg)
Querying a Database 2
• Create queries using Design view• Include fields in the design grid• Use text and numeric data in criteria• Save a query and use the saved query• Create and use parameter queries• Use compound criteria in queries• Sort data in queries
Objectives
![Page 3: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/3.jpg)
Querying a Database 3
• Join tables in queries• Create a report and a form from a query• Export data from a query to another application• Perform calculations and calculate statistics in
queries• Create crosstab queries• Customize the Navigation Pane
Objectives
![Page 4: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/4.jpg)
Querying a Database 4
Project – Querying a Database
![Page 5: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/5.jpg)
Querying a Database 5
• Create queries in Design view• Use criteria in queries• Sort data in queries• Join tables in queries• Export query results• Perform calculations in queries• Create a crosstab query• Customize the Navigation Pane
Roadmap
![Page 6: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/6.jpg)
Querying a Database 6
• Tap or click the ‘Shutter Bar Open/Close Button’ to close the Navigation Pane
• Tap or click CREATE on the ribbon to display the CREATE tab• Tap or click the Query Design button (CREATE tab | Queries
group) to create a new query• Tap or click the table to add to the query• Tap or click the Add button to add the selected table to the query• Tap or click the Close button to remove the dialog box from the
screen• Drag the lower edge of the field list down far enough so all fields
in the table appear
Creating a Query in Design View
![Page 7: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/7.jpg)
Querying a Database 7
Creating a Query in Design View
![Page 8: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/8.jpg)
Querying a Database 8
• Double-tap or double-click each field to add to the query
Adding Fields to the Design Grid
![Page 9: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/9.jpg)
9Querying a Database
Using Text Data in Criterion
• Tap or click the Criteria row for the field to produce an insertion point
• Type the criterion• Tap or click the Run button
(QUERY TOOLS DESIGN tab | Results group) to run the query
![Page 10: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/10.jpg)
Querying a Database 10
• Tap or click the Save button on the Quick Access Toolbar to display the Save As dialog box
• Type the name of the query• Tap or click the OK button (Save As dialog box) to
save the query
Using Text Data in Criterion
![Page 11: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/11.jpg)
Querying a Database 11
• If necessary, tap or click the Criteria row below the desired field to produce an insertion point
• If necessary, delete the current entry• Type the criterion containing the wildcard
character (*)
Using a Wildcard
![Page 12: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/12.jpg)
Querying a Database 12
Using a Wildcard
![Page 13: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/13.jpg)
Querying a Database 13
• With the desired query open, tap or click the Show check box to remove the check mark for a field containing criteria
Using Criteria for a Field Not Included in the Results
![Page 14: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/14.jpg)
Querying a Database 14
Using Criteria for a Field Not Included in the Results
![Page 15: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/15.jpg)
Querying a Database 15
• If necessary, return to Design view and type the criterion for a parameter query ([Enter City], for example)
• Run the query
Creating and Viewing a Parameter Query
![Page 16: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/16.jpg)
Querying a Database 16
Creating and Viewing a Parameter Query
![Page 17: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/17.jpg)
Querying a Database 17
• Tap or click the Query Design button (CREATE tab | Queries group) to create a new query
• Tap or click the table you wish to add to the query• Tap or click the Add button to add the selected
table to the query• Tap or click the Close button to remove the dialog
box from the screen• Add the desired fields to the query• Add a numeric criterion for a numeric field
Using a Number in a Criterion
![Page 18: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/18.jpg)
Querying a Database 18
Using a Number in a Criterion
![Page 19: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/19.jpg)
Querying a Database 19
• Open the query in Design view• Enter the criterion with a comparison operator
Using a Comparison Operator in a Criterion
![Page 20: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/20.jpg)
Querying a Database 20
• Open the query in Design view• Add the criteria for two fields in the Criteria row
Using a Compound Criterion Involving AND
![Page 21: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/21.jpg)
Querying a Database 21
• Open the query in Design view• Add criterion for one field to the Criteria row• Add criterion for another field in the or row (the
row below the Criteria row)
Using a Compound Criterion Involving OR
![Page 22: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/22.jpg)
Querying a Database 22
• Open the query in Design view• Tap or click just above the column heading in the
first column in the grid to select the column• Hold the SHIFT key down and tap or click just
above the last column heading to select all the columns
• Press the DELETE key to clear the design grid
Clearing the Design Grid
![Page 23: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/23.jpg)
Querying a Database 23
Clearing the Design Grid
![Page 24: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/24.jpg)
Querying a Database 24
• Open the query in Design view• Tap or click the Sort row below the field you wish
to sort, and then click the Sort row arrow to display a menu of possible sort orders
• Click the desired sort order
Sorting Data in a Query
![Page 25: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/25.jpg)
Querying a Database 25
• Open the query in Design view• Tap or click an empty field in the design grid• Tap or click the Property Sheet button (QUERY TOOLS DESIGN
tab | Show/Hide group) to display the property sheet• Tap or click the Unique Values property box, and then tap or
click the arrow that appears to produce a list of available choices
• Tap or click Yes and then close the Query Properties property sheet by tapping or clicking the Property Sheet button (QUERY TOOLS DESIGN tab | Show / Hide group) a second time
Omitting Duplicates
![Page 26: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/26.jpg)
Querying a Database 26
Omitting Duplicates
![Page 27: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/27.jpg)
Querying a Database 27
• Open the query in Design view• Select a sort order in the Sort column for multiple
fields
Sorting on Multiple Keys
![Page 28: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/28.jpg)
Querying a Database 28
• Open the query in Design view• Click the Return arrow (QUERY TOOLS DESIGN tab
| Query Setup group) to display the Return menu• Tap or click an option corresponding to the values
you wish to return
Creating a Top-Values Query
![Page 29: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/29.jpg)
Querying a Database 29
Joining Tables
![Page 30: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/30.jpg)
Querying a Database 30
• Tap or click the Query Design button (CREATE tab | Queries group) to create a new query
• Add two related tables to the new query• Add the desired fields from each table to the
query
Joining Tables
![Page 31: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/31.jpg)
Querying a Database 31
Joining Tables
![Page 32: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/32.jpg)
Querying a Database 32
Joining Tables
![Page 33: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/33.jpg)
Querying a Database 33
• Open the query in Design view• Press and hold or right-click the join line to
produce a shortcut menu• Tap or click Join Properties on the shortcut menu
to display the Join Properties dialog box
Changing Join Properties
![Page 34: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/34.jpg)
Querying a Database 34
Changing Join Properties
![Page 35: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/35.jpg)
Querying a Database 35
• Open the Navigation Pane, and then select the desired query in the Navigation Pane
• Tap or click the Report Wizard button (CREATE tab | Reports group) to display the Report Wizard dialog box
• Add the desired fields to the query• Follow the remaining steps in the wizard to specify a
grouping, sort order, layout and orientation, and title• Tap or click the Finish button to produce the report
Creating a Report from a Query
![Page 36: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/36.jpg)
Querying a Database 36
Creating a Report from a Query
![Page 37: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/37.jpg)
Querying a Database 37
• Select the query in the Navigation Pane• Tap or click the Form button (CREATE tab | Forms
group) to create a simple form
Creating a Form for a Query
![Page 38: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/38.jpg)
Querying a Database 38
• Tap or click the desired query in the Navigation Pane to select it
• Tap or click the Excel button (EXTERNAL DATA tab | Export group) to display the Export - Excel Spreadsheet dialog box
• Tap or click the Browse button (Export - Excel Spreadsheet dialog box) to display the File Save dialog box
• Navigate to the location to save the exported file• Tap or click the OK button (Export - Excel Spreadsheet
dialog box) to export the data
Exporting Data to Excel
![Page 39: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/39.jpg)
Querying a Database 39
• Tap or click the ‘Save export steps’ check box (Export - Excel Spreadsheet dialog box) to display the Save Export Steps options
• Type the desired name for the steps in the Save as text box
• If necessary, type a description for the export steps
• Tap or click the Save Export button (Export - Excel Spreadsheet dialog box) to save the export steps
Exporting Data to Excel
![Page 40: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/40.jpg)
Querying a Database 40
Exporting Data to Excel
![Page 41: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/41.jpg)
Querying a Database 41
• Open the query containing a join• Type the criterion for the desired field
Restricting the Records in a Join
![Page 42: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/42.jpg)
Querying a Database 42
• Open the query in Design view containing a field that can be calculated
• Press and hold or right-click the Field row in the first open column in the design grid to display a shortcut menu
• Tap or click Zoom on the shortcut menu to display the Zoom dialog box
• Type the calculation in the Zoom dialog box• Tap or click the OK button (Zoom dialog box) to enter
the expression
Using a Calculated Field in a Query
![Page 43: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/43.jpg)
Querying a Database 43
Using a Calculated Field in a Query
![Page 44: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/44.jpg)
Querying a Database 44
• Open the query in Design view• Tap or click the field in the design grid to which you
wish to add the caption, and then tap or click the Property Sheet button (QUERY TOOLS DESIGN tab | Show/Hide group) to display the properties for the field
• Tap or click the Caption box, and then type the desired caption
• Close the property sheet by tapping or clicking the property Sheet button a second time
Changing a Caption
![Page 45: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/45.jpg)
Querying a Database 45
Changing a Caption
![Page 46: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/46.jpg)
Querying a Database 46
• Create a new query for a table containing fields for which you can calculate statistics
• Tap or click the Totals button (QUERY TOOLS DESIGN tab | Show/Hide group) to include the Total row in the design grid
• Add the field for which you wish to total• Tap or click the Total row for the added field• Tap or click the Total arrow to display the Total list• Select the desired calculation for Access to perform
Calculating Statistics
![Page 47: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/47.jpg)
Querying a Database 47
Calculating Statistics
![Page 48: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/48.jpg)
Querying a Database 48
• Add a field to the query containing statistics for which you wish to add criteria
• Tap or click the Total row in the desired column• Tap or click the Total arrow for the added field to
produce a Total list• Tap or click Where• Type the criterion in the Criteria row
Using Criteria in Calculating Statistics
![Page 49: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/49.jpg)
Querying a Database 49
Using Criteria in Calculating Statistics
![Page 50: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/50.jpg)
Querying a Database 50
Using Grouping
![Page 51: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/51.jpg)
Querying a Database 51
Crosstab Queries
![Page 52: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/52.jpg)
Querying a Database 52
• Tap or click the Query Wizard button (CREATE tab | Queries group) to display the New Query dialog box
• Tap or click Crosstab Query Wizard (New Query dialog box)
• Tap or click the OK button to display the Crosstab Query Wizard dialog box
• Follow the instructions in the wizard to select the row and column headings for the query, and then name the query
Creating a Crosstab Query
![Page 53: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/53.jpg)
Querying a Database 53
Creating a Crosstab Query
![Page 54: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/54.jpg)
Querying a Database 54
• If necessary, tap or click the Shutter Bar Open/Close Button to open the Navigation Pane
• Tap or click the Navigation Pane arrow to produce the Navigation Pane menu
• Tap or click the desired option to organize the Navigation Pane
Customizing the Navigation Pane
![Page 55: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/55.jpg)
Querying a Database 55
Customizing the Navigation Pane
![Page 56: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/56.jpg)
Querying a Database 56
• Create queries using Design view• Include fields in the design grid• Use text and numeric data in criteria• Save a query and use the saved query• Create and use parameter queries• Use compound criteria in queries• Sort data in queries
Chapter Summary
![Page 57: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/57.jpg)
Querying a Database 57
• Join tables in queries• Create a report and a form from a query• Export data from a query to another application• Perform calculations and calculate statistics in
queries• Create crosstab queries• Customize the Navigation Pane
Chapter Summary
![Page 58: Access Chapter 02](https://reader033.vdocuments.site/reader033/viewer/2022061208/548b4d35b47959f10c8b6198/html5/thumbnails/58.jpg)
Chapter 2 Complete
MicrosoftAccess 2013