Syntax error (missing operator) in query expression RRS feed

  • Question

  • User1506304638 posted



    I have an issue in Access when i try to updata a table called User. I have made a form called frmGRPE with text fields where i retrives information (user information) from a database called tblUser. I can retrive the information from the database, but the problem starts when i trie to save the changes in the form back in to the databse. I use the function UPDATE for this and i can almost get this to work. Below is two expressions where the first gives me syntax error and the other inputs ME.txtEN.Value into the correct location in the databse(obviously since i put ME.txtEN.Value inside '  '.


    1. CurrentDb.Execute "UPDATE tblUser " & "SET Employee_Number= Me.txtEN.Value" & "Where [User_ID]=" & Me.txtUser.Value
    2. CurrentDb.Execute "UPDATE tblUser " & "SET Employee_Number= 'Me.txtEN.Value'" & "Where [User_ID]=" & Me.txtUser.Value


    My question is why does this this work (second expression) when i SET sepcific value from code intot the databse, but when i try to get this value from the txtEN field in the form form i get syntax error?!!


    Thanx in advance for any help on this issue!!

    Monday, October 28, 2013 1:32 PM


  • User1508394307 posted

    Must be

    CurrentDb.Execute "UPDATE tblUser SET Employee_Number= '" & Me.txtEN.Value & "' Where [User_ID]=" & Me.txtUser.Value

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 28, 2013 1:36 PM

All replies