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.

In

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

[Access Query Designer showing an IN clause]

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.

Between

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

[Access Query Designer showing a Between clause]

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".