ACC: How to Create a Parameter Query on a Yes/No Field That Accepts Yes, No, and *

Article translations Article translations
Article ID: 174907 - View products that this article applies to.
This article was previously published under Q174907
Novice: Requires knowledge of the user interface on single-user computers.

Expand all | Collapse all

SUMMARY

This article describes how to create a parameter query that uses a Yes/No data type field that accepts the values of Yes, No, and * (asterisk), where * returns all values in the field.

MORE INFORMATION

To create a parameter query that displays all records that contain Yes, No, or all values, follow the steps for your version of Microsoft Access. Steps 1 through 3 are different; step 4 through 7 are the same for all versions.

In Microsoft Access 2.0
-----------------------
  1. Open the sample database NWIND.MDB.
  2. In the Database window, click the Query tab, click New, and then click New Query.
  3. In the Add Table dialog box, select the Products table, click Add, and then click Close.
In Microsoft Access 95 and 97
-----------------------------
  1. Open the sample database Northwind.mdb. In the Database window, click the Queries tab, and then click New.
  2. In the New Query dialog box, click Design view and click OK.
  3. In the Show Table dialog box, select the Products table, click Add, and then click Close.
In Microsoft Access 2.0, 7.0, and 97
------------------------------------
  1. In the first column in the QBE grid, type the following:
             Field:    MyParam: IIf([Discontinued]=-1, "Yes","No")
             Show:     True
             Criteria: Like [Enter Yes, No or *]
  2. In the second column in the QBE grid, type the following:
             Field: Enter Yes, No or *: [Discontinued,*0/-1/*]
             Show:  False
  3. On the Query menu, click Run.
  4. Note that you are prompted with the Enter Parameter Value box. You can enter Yes, No, or "*", where "*" returns all values.

REFERENCES

For more information about Yes/No fields, please see the following articles in the Microsoft Knowledge Base:

101076 ACC: Expressions to Count Yes, No, and Other Responses

94391 ACC: Cannot Use "y," "n," "t," or "f" in Yes/No Field

88671 ACC: How to Use the LIKE Operator in Parameter Queries

Properties

Article ID: 174907 - Last Review: January 20, 2007 - Revision: 2.1
APPLIES TO
  • Microsoft Access 2.0 Standard Edition
  • Microsoft Access 95 Standard Edition
  • Microsoft Access 97 Standard Edition
Keywords: 
kbhowto KB174907
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com