The information in this article applies to:
SYMPTOMSWhen you use the SQLRetrieve function to return data to Microsoft Excel, the data that will be returned to a cell is one row below the cell specified in a previous call to the SQLBind function. CAUSE
It is possible to bind one column of an external data source to a specific
cell location on a worksheet. This is accomplished using the SQLBind
function.
WORKAROUNDMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.aspWhen you use SQLBind and SQLRetrieve together, as in the "Symptoms" and "Cause" sections above; you will need to adjust for the blank cell when you retrieve data that does not contain column headings. One way to work around this problem is to delete the blank cell after the data is returned, shifting the remainder of the column upward. The following sample Microsoft Visual Basic for Applications macro (Sub procedure) accomplishes this workaround. Sample Visual Basic Procedure
Note that another method for adjusting the blank cell is to adjust the
reference made in the SQLBind command to be one row above the originally
planned cell. However, this method can present a problem if you
want to return data to row number one, because there is no row above row
number one.
STATUSMicrosoft has confirmed this to be a problem in Microsoft Excel 98 Macintosh Edition. MORE INFORMATIONIf the SQLBind function has not been used to specify a location for the data to be returned, the SQLRetrieve function will return the data and/or column headings to the correct destination, as specified by the SQLRetrieve function. REFERENCESFor additional information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base: Q163435 VBA: Programming Resources for Visual Basic for Applications Additional query words: XL98
Keywords : kbdta kbdtacode ODBCGen |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |