Set up Query Criteria in Access 2016

The query criteria (Query Criteria) are filter conditions that help you retrieve specific items from an Access database, used when you want to limit results based on values ​​in a field.

The query criteria (Query Criteria) are filter conditions that help you retrieve specific items from an Access database, used when you want to limit results based on values ​​in a field. If the data matches all criteria, it will appear in the query results.

  1. The query criteria is an expression that Access collects with values ​​in the query fields to determine whether the records contain that value.
  2. Some criteria are simple, just use basic operators and constants. More complex criteria use functions, special operators, and other field references.
  3. To add some criteria to the query, you must open the query in Design View and then specify the fields you want to specify criteria.

Let's look at a simple example using criteria in a query. First, open your Access database, then go to the Create tab and click Query Design .

Set up Query Criteria in Access 2016 Picture 1Set up Query Criteria in Access 2016 Picture 1

In Show Table , select the table you want to query, here is tblNhanvien, double click and select Close.

Set up Query Criteria in Access 2016 Picture 2Set up Query Criteria in Access 2016 Picture 2

In the table window, double click on the name of the field you want to appear in the query. They will be added to the design grid at the bottom of the screen. Here we choose NhanvienID, Ten, Ho, ChucDanh, Dienthoai.

Set up Query Criteria in Access 2016 Picture 3Set up Query Criteria in Access 2016 Picture 3

After setting the search criteria, executing the query by clicking the Run command on the Design tab , you will see results like this:

Set up Query Criteria in Access 2016 Picture 4Set up Query Criteria in Access 2016 Picture 4

Now, if you want to display only those who have a Title, then add criteria to filter out the required records. Returning to Query Design and in the Criteria line of ChucDanh, enter the filtered value as Bien dich.

Set up Query Criteria in Access 2016 Picture 5Set up Query Criteria in Access 2016 Picture 5

Now run the Query again, you will see only the records of employees with titles that are Translated.

Set up Query Criteria in Access 2016 Picture 6Set up Query Criteria in Access 2016 Picture 6

If you want to add filtering criteria to multiple fields, just add the data you need to the Criteria line on multiple fields.

If you want to retrieve data with 2 different values ​​in the same field, for example filtering the title Bien tap and Truong nhom , specify the value in the OR row as follows:

Set up Query Criteria in Access 2016 Picture 7Set up Query Criteria in Access 2016 Picture 7

Results returned:

Set up Query Criteria in Access 2016 Picture 8Set up Query Criteria in Access 2016 Picture 8

If you want to use the function of the AND operator , you only need to specify other conditions in the Criteria row . Let us say that we want to retrieve all the Accountants Assistant but only the Marketing Coordinator titles with "Pollard" are the last name.

For example, if you want to retrieve the data of an employee with the title of Team Leader and Editor , but only the Editing of the Nguyen family .

Set up Query Criteria in Access 2016 Picture 9Set up Query Criteria in Access 2016 Picture 9

Results returned:

Set up Query Criteria in Access 2016 Picture 10Set up Query Criteria in Access 2016 Picture 10

Previous article: Data Query (Query Data) in Access 2016

Next article: Action Query in Action 2016

4.4 ★ | 8 Vote