XL97: How to Use Wildcards in Parameter Queries (164117)



The information in this article applies to:

  • Microsoft Excel 97 for Windows

This article was previously published under Q164117

SUMMARY

This article includes examples that show you how to use wildcards in parameter queries in Microsoft Query.

MORE INFORMATION

Parameter queries prompt you for values to use when querying for the result set that is returned. This allows you to use one query that selects different records based upon criteria you specify. By using a parameter query, you don't have to change the query design grid each time you run the query. Instead, Microsoft Query prompts you for the search criteria. You can specify multiple parameters for a field.

In the Criteria cell under each field you want to use as a parameter, type a prompt that is enclosed in square brackets. Microsoft Query displays this prompt when you run the query. The text of the prompt must be different from the field name; however, the prompt can include the field name.

The wildcard characters that are available in Microsoft Query and examples for using these characters in a parameter query are listed in the following table.
 Wildcard                              Parameter
 character    Definition               Query Example
 ---------------------------------------------------------------------

 +            Addition                 [Enter Price]+[Cost of Freight]

  -           Subtraction              [Enter Price]-[Cost of Freight]

 *            Multiplication           [Enter Price]*[Enter Quantity]

 /            Division                 [Enter Price]/[Enter Quantity]

 =            Equal to                 =[What city?]

 <>           Not equal to             <>[All cities but what?]

 >            Greater than             >[Greater than date?]

 <            Less than                <[Less than date?]

 >=           Greater than or
              equal to                 >=[Greater than or equal to date?]

 <=           Less than or
              equal to                 <=[Less than or equal to date?]

 And          Both values found        >[Greater than date?] And
              in the record set        <[Less than date?]

 Or           Either value found
              in the record set        [What city?] Or [What other city?]

 Not          Value not found
              in the record set        Not [All cities but what?]

 Between      Range of values          Between [start date] and
              between what two values  [end date]

 Like         Compares values to       Like [Enter letter(s) followed by
              find a similar value     the % sign (e.g. abc%)]

 In           Equal to several values  In ([first],[second],[third])
              in a list
				

REFERENCES

For more information about parameter queries, click the Index tab in Microsoft Query Help, type the following text
   parameter
				

and then double-click the selected text to go to the "Create a parameter query" topic.

Modification Type:MajorLast Reviewed:12/12/2002
Keywords:kbhowto kbtool kbualink97 KB164117