Add criteria to a query
One of the reasons why we use a “Query” is, to get answers to questions.
For example, the “Query” that we made in previous lessons gave me all the results of all students, of all subjects.
Suppose you want only those with the “excellent” grade to be seen in the results. To do this we need to add criteria to the “Query” by opening the “Query” in “Design View”. In the “Criteria” row under the “Grade” column, type the value that this field must have. You do not need to type the quotes, they are added automatically .
Click the “Run” button in the “Ribbon”.
“Access” will only display records that meet this criteria.
Another question my be, “Which of the students have a score less than 60?”
For this, remove the criteria from the “Grade” column and type <60 in the criteria row under the “score” column.
We can enter multiple criteria in our “Query”. Criteria entered on the same line are considered as an AND operator. This means that the data in the record must meet both criteria.
When we insert different criteria on different lines, it is regarded as an OR operator. Which means that the data in the record must meet atleast one of these criteria.
In the example above, if I had two criteria on the same line, I would’ve had little result. Indeed, there are no “excellent” assessments when the score is below 60.
However, when I place the criteria in different rows instead, I get all records where the assessment is “excellent”, or the score is less than 60.
So make sure when you have different criteria on the same line, only when you want all the criteria to be met with. When you use different criteria on different lines, any one of criteris should be met.
You've completed Lesson 25 START NEXT LESSON