Microsoft KB Archive/211974

= XL2000: Parameter Query Is Case-Sensitive =

Article ID: 211974

Article Last Modified on 9/27/2003

-

APPLIES TO


 * Microsoft Excel 2000 Standard Edition

-



This article was previously published under Q211974





SYMPTOMS
In Microsoft Query, when you type a value in a case (uppercase or lowercase) that does not match that of the value of the field in the external database, the query may not return data.



CAUSE
The value that you type for a parameter query that you create with Microsoft Query is case-sensitive.



WORKAROUND
To work around this issue, create a parameter query that is not case-sensitive.



MORE INFORMATION
To create a parameter query that is not case-sensitive, make sure that both of the following conditions are true:
 * The scalar function UCASE for the field (or expression) is used in the criteria.

-and-
 * The scalar function UCASE is used for the parameter.

The scalar function UCASE is used to convert values to uppercase. When you use it for this purpose, the function converts both the field (or expression) and the parameter value to uppercase. This allows you to type a value without regard to case.

Example
WARNING: Your use or modification of the SQL statement provided in this article is at your own risk. Microsoft provides this SQL statement "as is" without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. Microsoft does not support modifications of the SQL statement to suit specific customer requirements.

This example creates a parameter query from the sample dBASE IV file Employee.dbf that is included with Microsoft Excel 2000. The case-insensitive parameter uses the Last_Name field in the table. (The default location for the sample file is C:\Program Files\Microsoft Office\Office\Employee.dbf.)

To create a case-insensitive parameter query, follow these steps:  In Microsoft Excel 2000, create a new workbook. On the Data menu, point to Get External Data, and then click New Database Query. When you are prompted to select a database, select dBASE Files*, click to clear the Use the Query Wizard to create/edit queries check box, and then click OK. When you are prompted to add a table to the query, navigate to C:\Program Files\Microsoft Office\Office\1033\Employee.dbf, click Add, and then click Close. In the Query window, double-click the asterisk (*) in the Employee pane.

This step adds all of the records from the Employee table to the data pane.</li> Click Criteria on the View menu, and then click Add Criteria on the Criteria menu.</li> In the Add Criteria dialog box, follow these steps: <ol style="list-style-type: lower-alpha;"> In the Field box, type UCASE(Last_Name) .</li> In the Operator box, click equals.</li> In the Value box, type UCASE([Enter the employee's last name:]) .</li> Click Add.</li></ol> </li> When you are prompted to type a value for the parameter, type one of the values in the Last_Name field of the Employee table.</li> Click OK, and then click Close.</li> On the File menu, click Return Data to Microsoft Excel.</li> In Excel, click OK.</li></ol>

When you refresh the query, you do not have to be concerned with the case of the value that you type for the parameter.

<div class="references_section">