Queries: find the data you need

Study Part 3 · Topic 3 of 5

Ask questions of your data with criteria, sorting and calculated fields.

35 minInteractiveMicrosoft Access
0 activities complete
Hands on

Build a query

Choose criteria below. Watch the records filter and see the query that Access would write for you (in SQL, the language behind every query).

Query the Members table
MemberProvinceCourseFee (R)Status
Thandi MokoenaGautengExcel1450Paid
Pieter van WykFree StateWord980Paid
Ayesha PatelKwaZulu-NatalExcel1450Owing
Sipho DlaminiGautengAccess1650Paid
Lerato MolefeLimpopoWord980Owing
Johan SmitWestern CapeAccess1650Paid
Zanele KhumaloGautengWord980Owing
Fatima MoosaWestern CapeExcel1450Paid
Query Design

Create a select query

Create a query in five steps
1

Open Query Design

Create > Query Design, then add the table or tables you need.

2

Add fields

Double-click each field you want to see. It drops into the design grid.

3

Type criteria

In the Criteria row type the condition, for example "Gauteng" under Province.

4

Sort

Choose Ascending or Descending in the Sort row.

5

Run

Click Run (!) to see the results. Save the query as qryGautengMembers.

Match the criteria to their meaning

Tap a term on the left, then its meaning on the right. 6 pairs to go

AND vs OR

Criteria on the same row must all be true (AND). Criteria on different rows mean either one can be true (OR).

Calculated fields

Type an expression in an empty column, for example VAT: [Fee]*0.15, to calculate a new value for every record.

Totals queries

Click Totals (Σ) to group records and Sum, Count or Average them, for example total fees per province.

Parameter queries

Type [Enter province] in the criteria row. Access asks for the value each time the query runs.

Knowledge check

Which criteria finds members whose surname starts with M?

Key takeaways

  • Queries filter, sort and calculate without changing the table.
  • Criteria on one row = AND; on separate rows = OR.
  • Wildcards (*) and operators (>, Between, Is Null) make powerful questions.