Hi there..
I'm going nuts here with that code and can't find the error which obviously is somewhere there. I have a data entry form which I want to use for entering new data to my database or to edit the existing records. I have a subform which lists only records marked as 'proposal'. I have an edit button and a piece of code that retrieves the marked record from the subform to the data entry form. That works well. Then I want to update that record and I keep on getting the error here... Run-time error '3144': Syntax error in UPDATE statement. Here's the code:
Can anyone tell me what's wrong here? I'm very new to VBA and don't really understand the problem here
Thanks for your help. I attach a screenshot of the form
Regards,
Michal
I'm going nuts here with that code and can't find the error which obviously is somewhere there. I have a data entry form which I want to use for entering new data to my database or to edit the existing records. I have a subform which lists only records marked as 'proposal'. I have an edit button and a piece of code that retrieves the marked record from the subform to the data entry form. That works well. Then I want to update that record and I keep on getting the error here... Run-time error '3144': Syntax error in UPDATE statement. Here's the code:
Code:
Private Sub SaveRecord_Click()
'when we click on button Add there are two options
'1. for insert
'2. for update
If Me.TxDEID.Tag & "" = "" Then
'this is for insert new
'add data to table
CurrentDb.Execute "INSERT INTO LLIS(LessonID, [Lesson Title], Phase, Stage, [Well Name], [Field Name], [Rig Name], Section, Activity, Vendor, Date, [Originator Initials], Department, Status, Description, [Learning Points]) " & _
"VALUES(" & Me.TxDELTitle & ",'" & Me.CbDEPhase & "','" & _
Me.CbDEStage & "','" & Me.CbDEWellName & "','" & Me.CbDEFieldName & "','" & Me.CbDERigName & "','" & Me.CbDESection & "','" & Me.CbDEActivity & "','" & Me.CbDEVendor & "','" & Me.TxDEDate & "','" & Me.CbDEOrigIni & "','" & Me.CbDEDept & "','" & Me.CbDEStatus & "','" & Me.TxDEDescr & "','" & Me.TxDELearnings & "')"
Else
'otherwise (Tag of TxDEID store the id of Lesson to be modified)
CurrentDb.Execute "UPDATE LLIS " & _
" SET ID=" & Me.TxDEID & _
", [Lesson Title]='" & Me.TxDELTitle & "'" & _
", Phase='" & Me.CbDEPhase & "'" & _
", Stage='" & Me.CbDEStage & "'" & _
", [Well Name]='" & Me.CbDEWellName & "'" & _
", [Field Name]='" & Me.CbDEFieldName & "'" & _
", [Rig Name]='" & Me.CbDERigName & "'" & _
", Section='" & Me.CbDESection & "'" & _
", Activity='" & Me.CbDEActivity & "'" & _
", Vendor='" & Me.CbDEVendor & "'" & _
", Date='" & Me.TxDEDate & "'" & _
", [Originator Initials]='" & Me.CbDEOrigIni & "'" & _
", Department='" & Me.CbDEDept & "'" & _
", Status='" & Me.CbDEStatus & "'" & _
", Description='" & Me.TxDEDescr & "'" & _
", [Learning Points]='" & Me.TxDELearnings & "'" & _
" WHERE ID=" & Me.TxDEID.Tag
End If
'clear form
CmdClear_Click
'refresh data in list form
LPQsubform.Form.Requery
End Sub
Can anyone tell me what's wrong here? I'm very new to VBA and don't really understand the problem here

Thanks for your help. I attach a screenshot of the form
Regards,
Michal