
Examples of Query Criteria
If you are interested in including only those records that match your criteria in a query, then specify one or more criteria at the time of designing the query.
The following sections contain examples of criteria that you can use in queries to limit the number of records.
Range of values (>, <, >=, <=, <>, or Between...And)
Expression |
Result |
> 234 |
For a Quantity field, numbers greater than 234 |
< 1200.45 |
For a UnitPrice field, numbers less than 1200.45 |
>= "Callahan" |
For a LastName field, all names from Callahan through the end of the alphabet |
Between #2/2/1999# And #12/1/1999# |
For an OrderDate field, dates from 2-Feb-99 through 1-Dec-99 (ANSI-89) |
Exclude values that don't match (Not)
Expression |
Result |
Not "USA" |
For a ShipCountry field, orders shipped to countries other than the USA |
Not 2 |
For an ID field, the employee whose ID doesn't equal 2 |
Not T* |
For a LastName field, employees whose names don't start with the letter "T" (ANSI-89) |
Values in a list (In)
Expression |
Result |
In("Canada", "UK") |
For a ShipCountry field, orders shipped to Canada or the UK |
In(France, Germany, Japan) |
For a CountryName field, employees living in France or Germany or Japan |
Wholly or partially matching text values
Expression |
Result |
"London" |
For a ShipCity field, orders shipped to London |
"London" Or "Hedge End" |
For a ShipCity field, orders shipped to London or Hedge End |
>="N" |
For a CompanyName field, orders shipped to companies whose name starts with the letters N through Z |
Like "S*" |
For a ShipName field, orders shipped to customers whose name starts with the letter S (ANSI-89) |
Matching patterns (Like)
Expression |
Result |
Like "S*" |
For a ShipName field, orders shipped to customers whose names start with the letter S (ANSI-89) |
Like "*Imports" |
For a ShipName field, orders shipped to customers whose names end with the word "Imports" (ANSI-89) |
Like "[A-D]*" |
For a ShipName field, orders shipped to customers whose names start with A through D (ANSI-89) |
Like "*ar*" |
For a ShipName field, orders shipped to customers whose names include the letter sequence "ar" (ANSI-89) |
Null and zero-length strings
Expression |
Result |
Is Null |
For a ShipRegion field, orders for customers whose ShipRegion field is Null (Null: A value you can enter in a field or use in expressions or queries to indicate missing or unknown data. In Visual Basic, the Null keyword indicates a Null value. Some fields, such as primary key fields, can't contain Null.) (blank) |
Is Not Null |
For a ShipRegion field, orders for customers whose ShipRegion field contains a value |
" " |
For a Fax field, orders for customers who don't have a fax machine, indicated by a zero-length string (zero-length string: A string that contains no characters. |
Date values
Expression |
Result |
#2/2/2000# |
For a ShippedDate field, orders shipped on February 2, 2000 (ANSI-89) |
'2/2/2000' |
For a ShippedDate field, orders shipped on February 2, 2000 (ANSI-92) |
Date() |
For a RequiredDate field, orders for today's date |
Between Date( ) And DateAdd("M", 3, Date( )) |
For a RequiredDate field, orders required between today's date and three months from today's date |
< Date( ) - 30 |
For an OrderDate field, orders more than 30 days old |
Year([OrderDate]) = 1999 |
For an OrderDate field, orders with order dates in 1999 |

