How to Create a Yes or No Query in Microsoft Access

Microsoft Access is a database system which provides an easy to use interface for the end user. Tasks like creating, and managing databases, creating tables and queries to fetch data from those tables has been made easy in Microsoft Access. In this tutorial, we will learn how to create a query in Access with a Yes or No criterion.


Step#1: Create a new Query

Just consider the Products table of this sample database here.

Notice that there are some products in this database which are discontinued. Now what if you want to limit the search results based on certain values in a field. For that, we can create a query in Access using a Yes or No criterion, tabulating the results based on that particular field.

To begin, move to the Create tab and then click on the Query Design option in the Other Section.
Now let’s add the products table from here and close the selection window.

adding product table to the new query

Step#2: Specifying Criterion into the query

With that done, let’s select the fields to be added in the criteria. Over here, we will choose the Product code field, name, description, standard cost, and the discontinued field.

Under the discontinued field, in the Criteria section, just type ”yes” against the criteria field, and then run the query.

A table would be populated showing only the Discontinue products.

adding YES to the search criterion

Step#3: Using criterion differently

What if we want to see the records of the products which are not discontinued? For that we will use the “No” query here.

For that, open the query table and right click on Query Tab and select the Design View option.

Now just remove the check mark under the ‘Discontinued’ field and then change the criteria from Yes to No.

Once done, run the query. A table will be populated displaying all the products which are not discontinued.

displaying search result with a NO criterion