Alternate Criteria in Access 2016

In addition to the uses of the TipsMake.com query introduced in the previous lessons, you can also view data and records that meet two or more conditions using the alternative criteria.

Queries are very powerful in the database thanks to fast and accurate data analysis capabilities. In addition to the uses of the TipsMake.com query introduced in the previous lessons, you can also view data and records that meet two or more conditions using the alternative criteria .

You can add alternate criteria in two ways:

  1. Use the OR operator to combine two sets of criteria.
  2. Use query design grid, but instead of specifying criteria on the same line, you'll separate it into multiple rows.

Specifically invite readers to follow the content below.

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

Alternate Criteria in Access 2016 Picture 1Alternate Criteria in Access 2016 Picture 1
Go to the Create tab and select Query Design to appear Show Table

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

Alternate Criteria in Access 2016 Picture 2Alternate Criteria in Access 2016 Picture 2
The names of the fields of tblNhanvien will appear for you to choose

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 .

Alternate Criteria in Access 2016 Picture 3Alternate Criteria in Access 2016 Picture 3
Choose NhanvienID, Ten, Ho, ChucDanh and Dienthoai fields

Now specify replacement criteria in different rows of Ho school . When running this query, you will show employees whose last name is Bui or Vu.

Alternate Criteria in Access 2016 Picture 4Alternate Criteria in Access 2016 Picture 4
Employees whose last name is "Bui" or "Vu" will show up when running the query

Execute the query by clicking the Run command on the Design tab , you will see results like this:

Alternate Criteria in Access 2016 Picture 5Alternate Criteria in Access 2016 Picture 5
An employee information record appears with them as replacement criteria

If you want to apply replacement criteria in multiple fields, you add conditions to different rows for the corresponding field. Now, try adding another alternative criterion, in addition to employees with family name is Vu or Bui, we add the condition to have a job title is Translated .

Alternate Criteria in Access 2016 Picture 6Alternate Criteria in Access 2016 Picture 6
Add "Biendich" to the Chucdanh field to get more records

Results returned:

Alternate Criteria in Access 2016 Picture 7Alternate Criteria in Access 2016 Picture 7
Results include "Vu", "Bui" employees and "Bien dich" titles.

Previous article: Parameter Query in Access 2016

Next lesson: Alternate Criteria in Access 2016

5 ★ | 1 Vote