Microsoft KB Archive/174907

From BetaArchive Wiki
Knowledge Base


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

Article ID: 174907

Article Last Modified on 1/20/2007



APPLIES TO

  • Microsoft Access 2.0 Standard Edition
  • Microsoft Access 95 Standard Edition
  • Microsoft Access 97 Standard Edition



This article was previously published under Q174907

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


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


Additional query words: inf

Keywords: kbhowto KB174907