XL98: How to Create Parameter QueriesLast reviewed: February 2, 1998Article ID: Q180184 |
The information in this article applies to:
SUMMARYA parameter query is a kind of query that prompts you to specify values that are used to select the records for the result set. This allows the same query to be used to retrieve different results. You can create a custom prompt that describes the requested parameter and that is displayed when the query is run.
MORE INFORMATIONA result set is a set of records that results when you run a query. You can see the result set of a query in Microsoft Query or you can return a result set to a Microsoft Excel worksheet for further analysis. Microsoft Query displays the result set in row-and-column format in the Data pane. The criteria is one or more conditions you specify to limit which records are included in the result set of a query.
ExampleThe following example, using the sample dBASE file Order.dbf, creates a parameter query that selects records by city. When you run the query, a prompt appears and displays "Type the name of the city." The result set returns only the records for the city that is entered by the user. NOTE: a parameter query is case-sensitive. To use this example, follow these steps:
Using the Like OperatorTo return all the data in a parameter query or partially matching records in a field, ensure that when you create the parameter, the leading parameter bracket ([) is preceded by the operator LIKE. LIKE is used in conjunction with the % wildcard. The % wildcard is similar to the * wildcard in MS-DOS, which returns all characters. For example, using the example above, change the parameter in step 9 from the following
["Enter a city."]to the following
Like ["Enter a city."]To use this parameter and return all records that begin with the letter "S," type "S%" (without the quotation marks) in the Enter Parameter Value dialog box. To return all records, enter the % by itself. For additional information, please see the following articles in the Microsoft Knowledge Base:
ARTICLE-ID: Q164117 TITLE : XL97: How to Use Wildcards in Parameter Queries ARTICLE-ID: Q179700 TITLE : XL98: "Out of Range" Error Running Parameter Query in MS Query |
Additional query words: OFF98 xl98 msquery
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |