SQLRetrieve Defines Field Names on Active Workbook (117644)
The information in this article applies to:
- Microsoft Excel for Windows 95
- Microsoft Excel for Windows 5.0c
- Microsoft Excel for the Macintosh 5.0a
This article was previously published under Q117644 SUMMARY
In Microsoft Excel, if you are using the Visual Basic, Applications Edition
SQLRetrieve command, and you want each column of results to be declared as
a named range on the worksheet, you can set the "NamedRngLogical" argument
to TRUE.
The name of each range is the field name of a column's result set. The
syntax for the SQLRetrieve statement is as follows:
SQLRetrieve(ConnectionNum, DestinationRef, MaxColumns, MaxRows,
ColNamesLogical, RowNumsLogical, NamedRngLogical,
FetchFirstLogical)
When you execute the SQLRetrieve command with the argument
"NamedRngLogical" set to TRUE, the column names in the result set will
always be defined on the active workbook regardless of what the
"DestinationRef" argument is set to. If no workbooks are active when you
run the SQLRetrieve command, and if "NamedRngLogical" is set to TRUE, you
will receive the #N/A error value; however, the records will still be
retrieved to the range specified by destination.
NOTE: The information in this article also applies to the Microsoft
Excel 4.0 command SQL.EXEC.QUERY.
Modification Type: | Minor | Last Reviewed: | 10/11/2006 |
---|
Keywords: | kbcode kbhowto kbProgramming KB117644 |
---|
|