ACC: Parameter Query on Yes/No Field That Accepts Yes, No, and *

Last reviewed: October 9, 1997
Article ID: Q174907
The information in this article applies to:
  • Microsoft Access versions 2.0, 7.0, 97

SUMMARY

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

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

MORE INFORMATION

To create the parameter query and display all records that contain Yes, No, or all values, follow the steps for your version of Microsoft Access.

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, Microsoft Access 7.0, and Microsoft Access 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:

   ARTICLE-ID: Q101076
   TITLE     : ACC: Expressions to Count Yes, No, and Other Responses

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

   ARTICLE-ID: Q88671
   TITLE     : ACC: How to Use the LIKE Operator in Parameter Queries


Additional query words: inf
Keywords : QryCrit QryHowto QryParm TblDatyp
Version : WINDOWS:2.0,7.0,97
Platform : WINDOWS
Hardware : x86
Issue type : kbhowto
Solution Type : kbworkaround


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 9, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.