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

ID: Q174907


The information in this article applies to:


SUMMARY

Novice: Requires knowledge of the user interface on single-user computers.

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:

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

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

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

Additional query words: inf


Keywords          : QryParm QryHowto QryCrit TblDatyp 
Version           : WINDOWS:2.0,7.0,97
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: April 27, 1999