ACC1x: Cannot DDE Execute RunSQL Command with BracketsLast reviewed: June 3, 1997Article ID: Q106185 |
The information in this article applies to:
SYMPTOMSYou receive an error message indicating that the process has failed when you use DDE from a DDE client application such as Microsoft Word for Windows or Microsoft Excel to run the RunSQL macro action in Microsoft Access version 1.1.
CAUSEThe SQL statement you are trying to run with the RunSQL command contains square brackets. When Microsoft Access receives the command it assumes that the first right square bracket marks the end of the command. For example, the command
UPDATE Employees SET [First Name] = 'Jim' WHERE [First Name] = 'Andrew';would be interpreted by Microsoft Access to be
UPDATE Employees SET [First Namewhich is not a complete command and cannot be run successfully.
RESOLUTIONThe SQL command must be enclosed in double quotation marks in the DDE execute string. The SQL command in the example above could be successfully sent as:
"[RunSQL "UPDATE Employees SET [First Name] = 'Jim' WHERE [First Name] = 'Andrew';"]" STATUSMicrosoft has confirmed this to be a problem in Microsoft Access version 1.1. This problem no longer occurs in Microsoft Access version 2.0.
MORE INFORMATION
Steps to Reproduce Problem
To correct the problem, enclose the SQL statement in double quotation marks, as follows:
Sub MAIN QT$ = Chr$(34) SQL$ = "UPDATE Employees SET [First Name] = 'Jim' " SQL$ = SQL$ + "WHERE [First Name]= 'Andrew';" chan = DDEInitiate("MSACCESS", "System") DDEExecute chan, "[RunSQL " + QT$ + SQL$ + QT$ + "]" DDETerminate chan End Sub |
Keywords : IntpDde kbinterop
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |