Query Criteria, Part 1: Be specific!

This is part 1 of a 3-part series about using criteria in queries.

Queries are a fundamental part of developing and using any database. In addition to providing a way to make bulk changes to your data, they are how you ask questions about that data. Query criteria help you make your question more specific – so instead of asking "What are my contacts' birthdays?" you could ask "Whose birthdays are coming up next month?"

Let's look at these questions in Access. The first question is a very simple query of a single table (Contacts). It just asks Access to select the name and date of birth of everyone in the table:

Query design with no criteria

When I run the query, I get the full list:

All records returned in query with no criteria

Very basic stuff. In this particular example, I don't have a huge list to look at, but imagine if I had hundreds of contacts. I probably wouldn't be interested in looking up all their birthdays very often. Now let's see how I could use a criterion to ask the more useful question: whose birthdays are this month?

Here's the query design again, only this time I've added an expression in the Criteria row of the DOB field:

Expression in the Criteria row for DOB field

Now when I run the query, I just see folks whose birthdays are this month:

Query criteria returns employees with birthday in current month

You can read more about how query criteria work and get a comprehensive set of examples in the article Examples of query criteria.

Next up: In part 2 of this 3-part series, learn about using the LIKE operator and wildcard characters as criteria.

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!