XL: SQL Statement Not Recorded in Macro If Query Returns NullLast reviewed: March 27, 1997Article ID: Q136872 |
5.00 5.00c 7.00
WINDOWS
kbtool xlquery
The information in this article applies to:
SYMPTOMSWhen you record a macro from Microsoft Excel to run Microsoft Query and return data back to Microsoft Excel, if the query that is run does not return any data, then an SQL statement will not be recorded. For example, if you run a query that looks in a particular field for all records that contain a value greater than 500 and there are no records that meet this criterion, then the recorder will not create the SQL statement to run the query.
WORKAROUNDTo work around this problem, use the following steps to set up your query manually and then copy it into your macro code:
NOTE: If this workaround does not produce the desired effect, set up your database so that it will return data under the conditions you are trying to use and then record the macro.
STATUSThis behavior is by design of Microsoft Excel. Microsoft Excel assumes that the query definition was incorrect.
MORE INFORMATIONFor more information about a specific XLODBC.XLA function, choose the Search button in Visual Basic Reference help, type the appropriate function name, and choose the Show Topics button. If you have an SQL statement that is longer than 255 characters, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q114992 TITLE : GP Fault in XLODBC.DLL Using SQLExecQuery or SQLRequestFor additional information on using SQL functions and the ODBC drivers, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q125898 TITLE : ODBC Examples from NT Help File Using NWind Data Source REFERENCES"User's Guide," version 5.0, chapter 23
|
KBCategory: kbtool
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |