Access 2016 Module 2
Building and Using Queries
1
Module Objectives
• Use the Query Wizard
• Work with data in a query
• Use Query Design View
• Filter data
• Apply AND criteria
• Apply OR criteria
© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a 2
password-protected website for classroom use.
Use the Query Wizard (Slide 1 of 2)
• A query allows you to select a subset of fields and records from one or more
tables and then present the selected data as a single datasheet
• a query datasheet is sometimes called a logical view of the data Because a
query doesn’t physically store the data,
• A query stores a set of SQL (Structured Query Language) commands
• Query Design View is an Access tool for writing queries without using SQL
© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a 3
password-protected website for classroom use.
Use the Query Wizard (Slide 2 of 2)
Simple Query Wizard
© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a 4
password-protected website for classroom use.
Work with Data in a Query (Slide 1 of 2)
• You enter and edit data in a query datasheet the same way you do in a table
datasheet
• Any edits you make in a query datasheet are permanently stored in the
underlying tables, and are automatically updated in all views of the data in
other queries, forms, and reports
© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a 5
password-protected website for classroom use.
Work with Data in a Query (Slide 2 of 2)
Working with data in a query datasheet
Updating
Stanley to
Captiva in
one record
updates all
records
© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a 6
password-protected website for classroom use.
Use Query Design View (Slide 1 of 2)
• Use Query Design View to:
• Add, delete, or move the fields in an existing query, to specify sort orders, or to add
criteria to limit the number of records shown in the resulting datasheet
• Create a new query from scratch
• Query Design View presents the fields you can use for that query in small
windows called field lists
• If you use the fields of two or more related tables in the query, the relationship
between two tables is displayed with a join or link line identifying which fields
are used to establish the relationship
© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a 7
password-protected website for classroom use.
Use Query Design View (Slide 2 of 2)
Query in Design View
© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a 8
password-protected website for classroom use.
Filter Data (Slide 1 of 4)
• Filtering provides a temporary way to display a subset of records that match given
criteria
• Filters are not used to calculate sums, averages, counts, etc.
• Filters are removed when the datasheet is closed
• Filters can be saved as queries
• Filter By Selection: is fast and easy way to Filter the records for exact match
• Filter By Form: to Filters for comparative data
-for example filter data where TripStartDate is equal to or greater than 7/1/2017)
© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a 9
password-protected website for classroom use.
Filter Data (Slide 4 of 4)
Filter buttons
© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a 10
password-protected website for classroom use.
Apply AND Criteria (Slide 1 of 4)
• You can limit the number of records that appear on query datasheet by entering criteria in
Query Design View.
• Criteria are tests or limiting conditions ,for which the record must be true to be selected for
the query datasheet.
• AND criteria means all criteria must be true for the record to be selected
• Created by entering two or more criteria in the same Criteria row of the query design grid
• Criteria Syntax
• Quotation marks (“) around text criteria and
• pound signs (#) around date criteria are automatically added by Access
• Criteria in Number, Currency, and Yes/No fields are not surrounded by any characters
© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a 11
password-protected website for classroom use.
Apply AND Criteria (Slide 4 of 4)
Comparison operators
© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a 12
password-protected website for classroom use.
Apply OR Criteria (Slide 1 of 2)
• OR criteria means any one criterion must be true for the record to be selected
• Created by entering two or more criteria on different Criteria rows of the query
design grid
© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a 13
password-protected website for classroom use.
Apply OR Criteria (Slide 2 of 2)
Query Design View with OR criteria
© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a 14
password-protected website for classroom use.