## PRB: Syntax Error on Page 196 of "Advanced Topics" Manual

Article ID: Q120886
Creation Date: 21-SEP-1994
Revision Date: 05-FEB-1996

The information in this article applies to:

- Microsoft Access Developer's Toolkit version 2.0

SYMPTOMS

Novice: Requires knowledge of the user interface on single-user computers.

Page 196 of the Microsoft Access Developer's Toolkit version 2.0 "Advanced Topics" manual contains the following sample code.

NOTE: In the following sample code, an underscore (_) at the end of a line is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this code in Access Basic.

       Sub PostRecords_Click ()
           Dim MyWS As WorkSpace, MyDB As Database
           On Error GoTo TransferFailed

           Set MyWS = DBEngine.Workspaces(0)
           Set MyDB = MyWS.Databases(0)

           MyWS.BeginTrans
           MyDB.Execute ("INSERT INTO RmtOrdersEmpty SELECT * from _
              LclOrders", DB_FAILONERROR)
           MyDB.Execute ("INSERT INTO RmtOrderDetailsEmpty SELECT * from _
              LclOrderDetails", DB_FAILONERROR)
           MyDB.Execute ("Delete from LclOrders")
           MyDB.Execute ("Delete from LclOrderDetails")
           MyWS.CommitTrans
           Me.Requery
           Exit Sub

       TransferFailed:
           MsgBox Error$
           MyWS.Rollback
           Exit Sub
       End Sub

When you compile this code, you receive the error message:

       Expected: )

CAUSE

The sample code incorrectly includes parentheses in the syntax of the Execute method.

RESOLUTION

Remove the parentheses from the syntax of the Execute method in the sample code. The corrected code is as follows.

NOTE: In the following sample code, an underscore (_) at the end of a line is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this code in Access Basic.

       Sub PostRecords_Click()
           Dim MyWS As WorkSpace, MyDB As Database
           On Error GoTo TransferFailed

           Set MyWS = DBEngine.workspaces(0)
           Set MyDB = MyWS.Databases(0)

           MyWS.BeginTrans
           MyDB.Execute "INSERT INTO RmtOrdersEmpty SELECT * from _
              LclOrders", DB_FAILONERROR
           MyDB.Execute "INSERT INTO RmtOrderDetailsEmpty SELECT * from _
              LclOrderDetails", DB_FAILONERROR
           MyDB.Execute "Delete from LclOrders"
           MyDB.Execute "Delete from LclOrderDetails"
           MyWS.CommitTrans
           Me.Requery
           Exit Sub

       TransferFailed:
           MsgBox Error$
           MyWS.Rollback
           Exit Sub
       End Sub

REFERENCES

Microsoft Access Developer's Toolkit "Advanced Topics," version 2.0, Chapter 7, "Developing Client/Server Applications," page 196

> THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

©1997 Microsoft Corporation. All rights reserved. Legal Notices.
Additional reference words: 2.00 adt
KBCategory: kbusage kbdocerr kberrmsg
KBSubcategory: DcmMnl