PRB: Special Character Causes ODBC Update Syntax ErrorLast reviewed: January 9, 1997Article ID: Q142191 |
The information in this article applies to:
SYMPTOMSUsing Visual FoxPro with ODBC to update a remote view designed visually with a Microsoft Access 2.0 or Microsoft Access 7.0 table with a tilde (~) character as the first character in a field name may generate either of the two following error messages:
[Microsoft][ODBC Microsoft Access 7.0 Driver] Syntax error in update statement. -or- Connectivity Error: [Microsoft][ODBC Microsoft Access 7.0 Driver] Syntax error in query expression '<tablename>.~<fieldname>'. CAUSEThe updatable field contains a tilde (~) character, which Visual FoxPro converts to an underscore.
WORKAROUNDThe following code demonstrates how to use SQL passthrough to accomplish the update to the Microsoft Access table. This example uses a Microsoft Access table named Family that contains these two fields:
Field 1 = ~first Field 2 = ~lastAlso, ~first is the primary key of the table. Add one record where ~first = "Adam" and ~last = "Smith."
STATUSThis behavior is by design.
MORE INFORMATIONIn Visual FoxPro the tilde (~) is not a valid character for a field name, although this is acceptable in Microsoft Access. Therefore, use of a Visual FoxPro ODBC Remote View to Microsoft Access, converts this special character to an underscore (_) character. The update using the Remote View then fails because Visual FoxPro sends an underscore instead of the tilde that Microsoft Access is expecting. For more information about Remote View Syntax, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q138501 TITLE : Modifying a Remote View Results in a Syntax Error |
Additional reference words: 3.00 3.00b VFoxWin
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |