XL5: Error/Incorrect Result Running SQL Function from ButtonLast reviewed: March 18, 1997Article ID: Q119259 |
The information in this article applies to:
SYMPTOMSIn Microsoft Excel, if you run a Visual Basic procedure that uses the SQLREQUEST function, the procedure returns an error message or an incorrect result if you run the procedure from a command button or from a toolbar button.
CAUSEThis behavior occurs only when you assign the procedure to a command button or a toolbar button, and run the procedure from the button. The correct result is returned when you run the procedure that contains the SQL function from the module sheet, or from the Macro dialog box.
WORKAROUNDTo avoid receiving an incorrect result or an error message when you choose a toolbar button to run a procedure that uses the SQLRequest function, call the procedure from another procedure, and then do the following to assign the calling procedure to the toolbar: Microsoft provides examples of Visual Basic procedures 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 Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose. For more information about Visual Basic for Applications programming style, see the "Programming Style in This Manual" section in the "Document Conventions" section of the "Visual Basic User's Guide."
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Excel version 5.0c for Windows.
MORE INFORMATIONThe SQLREQUEST function is available in the XLODBC.XLA. You can use this function in a Visual Basic procedure by creating a reference to the XLODBC.XLA file using the References dialog box (Tools menu).
REFERENCESFor more information about the SQLRequest Function, choose the Search button in the Visual Basic Reference and type:
SQLRequest Function |
Additional query words: 5.00 err msg2004 run-time cannot connect to
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |