Part I: Access Building Blocks
188
Cross-Reference
Chapter 4 gives an in-depth explanation of working with queries.
Using query comparison operators
When working with select queries, you may need to specify one or more criteria to limit the scope
of information shown. You specify criteria by using comparison operators in equations and calcula-
tions. The categories of operators are mathematical, relational, logical, and string. In select queries,
operators are used in either the Field or Criteria cell of the Query by Example (QBE) pane.
Table 5.5 shows the most common operators used with select queries.
TABLE 5.5
Common Operators Used in Select Queries
Mathematical Relational Logical String Miscellaneous
* (multiply) = (equal) And & (concatenate) Between...And
/ (divide) <> (not equal) Or Like In
+ (add) > (greater than) Not Not Like Is Null
- (subtract) < (less than) Is Not Null
Using these operators, you can ferret out groups of records like these:
l Product records that include a picture
l (^) A range of records, such as all sales between November and January
l Records that meet both And and Or criteria, such as all records that are cars and are not
either a truck or SUV
l All records that do not match a value, such as any category that is not a car
When you add criteria to a query, use the appropriate operator with an example of what you want.
In Figure 5.1, the example is Cars. The operator is equal (=). Notice that the equal sign is not
shown in the figure because it’s the default operator for select queries.