Chapter 5: Using Operators and Expressions in Access
187
The Boolean precedence
The Boolean operators follow this order of precedence:
- Not
- And
- Or
- Xor
- Eqv
- Imp
Using Operators and Expressions in
Queries
One of the most common uses of operators and expressions is when building complex query crite-
ria. A thorough understanding of how these constructs work can ease the process of building
sophisticated, useful queries. This section deals specifically with building query criteria using oper-
ators and expressions. Some of the information in the remainder of this chapter parallels earlier
discussions, but the context is specifically query design.
Knowing how to specify criteria is critical to designing and writing effective queries. Although que-
ries can be used against a single table for a single criterion, many queries extract information from
several tables using more complex criteria.
Because of this complexity, your queries are able to retrieve only the data you need, in the order
that you need it. You might, for example, want to select and display data from the Collectible Mini
Cars database to get the following information:
l (^) All buyers of Chevy car or Ford truck models
l All buyers who have purchased something during the past 60 days
l (^) All sales for items greater than $90
l The number of customers in each state
l (^) Customers that have made comments or complaints
As your database system evolves, you’ll want to retrieve subsets of information like these examples.
Using operators and expressions, you create complex select queries to limit the number of records
returned by the query. This section discusses select queries that use operators and expressions.
Later, you’ll apply this knowledge when working with forms, reports, and VBA code.