Microsoft KB Archive/131236

= Can't Apply Number Format to Data Returned by SQL.REQUEST =

Article ID: 131236

Article Last Modified on 8/15/2005

-

APPLIES TO


 * Microsoft Excel 95 Standard Edition
 * Microsoft Excel 5.0c
 * Microsoft Excel 5.0a for Macintosh

-



This article was previously published under Q131236



This article also applies to:
 * Microsoft Excel for Windows 5.0|5.0
 * Microsoft Excel for the Macintosh 5.0|5.0





SUMMARY
In Microsoft Excel 5.x or 7.0, if you use the XLODBC.XLA function SQL.REQUEST to return data to your worksheet, you cannot apply a number format to the data by choosing the Number command from the Format menu.

Using SQL.REQUEST creates a "link" to the data source and the data is returned as text--therefore, the data cannot be reformatted using a number format. This is by design in Microsoft Excel 5.x and 7.0.



MORE INFORMATION
To work around this limitation, you may use the TEXT function to reformat the data. For example, the following formula returns the text "6/5/1987":

=SQL.REQUEST("DSN=NWind",,,"SELECT Hire_Date FROM Employee WHERE Last_Name = 'Davolio'")

This formula can be modified so that the date is displayed in a different Date format. For example, the following formula returns the text "Jun-05- 1987":

=TEXT(SQL.REQUEST("DSN=NWind",,,"SELECT Hire_Date FROM Employee WHERE

Last_Name = 'Davolio'"),"mmm-dd-yyyy")

Additional query words: 5.00a 5.00c XL

Keywords: kbprb KB131236

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.