Syntax error in UPDATE statement 
Author Message
 Syntax error in UPDATE statement

Trying to update changes to a record in an Access 2000 Database table using
VB6.

The form uses unbound controls.
I have successfully retrieved the desired record from the database table,
and made changes to the desired fields in the record on the form.  Now I'm
trying to update the record in the database with the changes made on the
form.
I'm using an SQL statement and checked the syntax according to the books I
have available. I can't find the problem. Yet when I try to save changes I
get the error "Syntax error in UPDATE statement".

Instead of trying to change the entire record, I am attempting to change
only one field just to keep it simple until I can overcome the problem.

My Access200 database table is:  Table2
the record's key field in Access is named:  KeyCode
the corresponding  control on the VB6 form is:  LockCode (same
thing-different name)
the fieldname in Table2 that I'm trying to change is:  LastName
the corresponding textbox control & property on the VB6 form is:
txtLastName.text

Here is the code:

Private Sub cmdSave_Click()
    'Save Changes to record and clear form
    Dim strSQL As String
    On Error GoTo HandleErrors

    strSQL = "UpDate Table2 " & _
                "Set LastName = '" & txtLastName.Text & "', " & _
                "Where KeyCode = '" & txtLockCode.Text & "' "
    conProjectName1.Execute strSQL
'
'
'
Does anyone see the problem here?



Sat, 26 Jun 2004 23:30:09 GMT
 Syntax error in UPDATE statement

Lose the comma.


Quote:
> Trying to update changes to a record in an Access 2000 Database table
using
> VB6.

> The form uses unbound controls.
> I have successfully retrieved the desired record from the database table,
> and made changes to the desired fields in the record on the form.  Now I'm
> trying to update the record in the database with the changes made on the
> form.
> I'm using an SQL statement and checked the syntax according to the books I
> have available. I can't find the problem. Yet when I try to save changes I
> get the error "Syntax error in UPDATE statement".

> Instead of trying to change the entire record, I am attempting to change
> only one field just to keep it simple until I can overcome the problem.

> My Access200 database table is:  Table2
> the record's key field in Access is named:  KeyCode
> the corresponding  control on the VB6 form is:  LockCode (same
> thing-different name)
> the fieldname in Table2 that I'm trying to change is:  LastName
> the corresponding textbox control & property on the VB6 form is:
> txtLastName.text

> Here is the code:

> Private Sub cmdSave_Click()
>     'Save Changes to record and clear form
>     Dim strSQL As String
>     On Error GoTo HandleErrors

>     strSQL = "UpDate Table2 " & _
>                 "Set LastName = '" & txtLastName.Text & "', " & _
>                 "Where KeyCode = '" & txtLockCode.Text & "' "
>     conProjectName1.Execute strSQL
> '
> '
> '
> Does anyone see the problem here?



Sat, 26 Jun 2004 23:53:52 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Syntax Error in Update Statement

2. (0x80040E14) Syntax error in UPDATE statement.

3. (0x80040E14) Syntax error in UPDATE statement.

4. Syntax error in UPDATE statement while using a Memo field

5. Syntax error in UPDATE statement

6. HE: Syntax Error in UPDATE statement

7. Why "Syntax error in UPDATE statement" error?

8. -2147217900 Error: Syntax error in INSERT INTO statement

9. SQL Update Statement Syntax Help

10. Update statement syntax?

11. Help with SQL update statement syntax

12. Need help with Syntax on Update or Insert SQL Statement


 
Powered by phpBB® Forum Software