XL97: How to Use Wildcards in Parameter Queries

Last reviewed: February 12, 1998
Article ID: Q164117
The information in this article applies to:
  • Microsoft Excel 97 for Windows

SUMMARY

This article includes examples that 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%)]
    
    
    The characters that are not available in a parameter query are listed in the following table.

     Wildcard
     character     Definition                 Notes
     ---------------------------------------------------------------------
    
     In            Equal to several values    Use the And operator with
                   in a list multiple         prompts.
    
    
     Is Null       No value in the field
    
     Is Not Null   Field contains a value
    
    

    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.


  • KBCategory: kbusage kbtool
    KBSubcategory: xlquery
    Additional reference words: 97 XL97
    Keywords : xlquery kbtool kbualink97
    Version : WINDOWS:97
    Platform : WINDOWS


    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: February 12, 1998
    © 1998 Microsoft Corporation. All rights reserved. Terms of Use.