In and Between Queries

Queries let you answer a particular question by selecting records which match some test or criterion. Most simple queries use an equals sign in the criterion and they will find all records matching the value that you specify. Use the "In" and "Between" expressions for more flexibility.


For example you could use an "In" expression to find customers in the UK, France, and Germany:


You could of course have written this on three lines of the grid as "=UK", "=Germany" and "=France" but the shorter form saves typing.

The criterion can be inverted as "Not In(UK, France, Germany)" to give customers outside these three countries.

SQL subqueries take this concept one stage further but you do need to know a little SQL to be able to use them.


The meaning or "Between" is probably obvious, it gives you the records which lie between two values. For example:


There is a subtle problem with this example. It will give you all the countries between "A" and "G" but it won't give you "Germany". The reason is that "G" comes before "Germany" in the alphabet. If you wanted to get all the countries beginning with "G"as well then change the criterion to something like Between "A" and "Gzzzzz".

Access Tips

FoxPro Tips

General Tips


Related Items

Linking two listboxes in Microsoft Access

Linking parent and child listboxes in Microsoft Access so that selecting a new value in one listbox changes the values displayed in the other.

Read More

SQL Subqueries in Microsoft Access

Using SQL queries and subqueries in Microsoft Access

Read More

Faster SQL queries in Microsoft Access

How to improve the speed of SQL queries in an Access database

Read More

Update, Append, CrossTab and Delete queries in Microsoft Access

Update, Append, CrossTab and Delete queries in an Access database

Read More

Getting the top ten from a query

Getting the top ten from a query

Using a query in Microsoft Access to return the top ten values

Read More