Tuesday 8 January 2019

Microsoft Access Queries – Using Query Criteria

Using Query Criteria 


Criteria is needed when you don’t want to see the whole dataset.  Criteria will define which records are selected to be shown in the dynamic subset.

Criteria can be:

A simple match such as finding all the customers that are from a particular country . Whether certain data has been filled in or not.

A comparison such as finding all the products that cost more than a particular value

A formula can be used to select records such as finding all the orders where it took two weeks or more to deliver from the original order date.




To enter the criteria you need to be in the design view of the query. 

1. Select the fields that the criteria values are going to be applied to.

2. Enter the criteria values on.

3. Criteria rows.

When you enter the data on the criteria rows you need to consider whether they should be on the same row or different rows.  
If they are on the same row then both pieces of criteria apply.  In the above example it would find the category one products that cost more than twenty.   

If the “>20” had been on the next line down (the OR line),then the record must meet either one of criteria  

Then the criteria would have found all of the category one products whatever there price and all of the products that cost more than twenty whatever the category.  The reason for this is that the two pieces of criteria are not connected to each other. 

Examples of Criteria




Wild card characters can be used in the criteria when the data has to follow a particular pattern rather than a particular value.  Different characters match different values. 

The wildcard character “*” matches any combination of characters.
Like “B*” matches anything starting with the letter B. 

Like “*sauce” will find any product that finishes in Sauce. 

Like “*cheese*” will find any items that contains the word cheese. 

The wildcard “?” character matches a single character. 

“J??n” will match John and Joan but not Jon and Joanne. 

The wildcard character “#” matches a single digit.



























No comments:

Post a Comment