Results 1 to 2 of 2
  1. #1
    Pietro is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Feb 2015
    Posts
    2

    Syntax error in SQL UPDATE statement

    Hi Guys,

    I'm trying to perform an UPDATE statement from a module with DoCmd.RunSQL, but the code doesn't work, displaying error 3144, "syntax error in UPDATE statement". I've tried many solutions, but actually can't find the error.
    here is my code:

    Sub EditRecord()
    Dim SQL As String
    Dim Supp As Integer
    Dim Fname As String
    Dim Lname As String
    Dim Tel As String
    Dim Mob As String
    Dim Mai As String
    Dim Note As String
    Dim IDCon As Integer



    Supp = Forms!Add_Contact.Cbo_ID_SUPPLIER
    Fname = Forms!Add_Contact.First_Name
    Lname = Forms!Add_Contact.Last_Name
    Tel = Forms!Add_Contact.Telephone
    Mob = Forms!Add_Contact.Mobile
    Mai = Forms!Add_Contact.Mail
    Note = Forms!Add_Contact.Notes
    IDCon = Forms!Contact.ID_CONTACT

    SQL = "UPDATE Contacts" & _
    "SET Contacts.ID_SUPPLIER = " & Supp & ", Contacts.First_Name = '" & Fname & "', Contacts.Last_Name = '" & Lname & "', " & _
    "Contacts.Telephone = '" & Tel & "', Contacts.Mobile = '" & Mob & "', Contacts.Mail = '" & Mai & "', Contacts.Notes = '" & Note & "' " & _
    "WHERE Contacts.ID_CONTACT = " & IDCon & "; "

    DoCmd.RunSQL SQL

    End Sub

    Could someone help me please?
    Pietro

  2. #2
    Pietro is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Feb 2015
    Posts
    2
    I missed a space after "UPDATE Contacts"!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 09-22-2014, 08:54 AM
  2. Error 3144: Syntax error in UPDATE statement??
    By Paintballlovr in forum Programming
    Replies: 7
    Last Post: 03-26-2014, 12:53 PM
  3. sql update statement syntax error
    By osupratt in forum Queries
    Replies: 7
    Last Post: 10-18-2013, 07:42 AM
  4. Syntax error in UPDATE statement HELP!
    By asmith78 in forum SQL Server
    Replies: 5
    Last Post: 09-07-2011, 05:50 PM
  5. Replies: 7
    Last Post: 08-17-2011, 01:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums