我有一个具有多种功能的大型表单,其中一个功能是编辑一个包含代码列表和其他各种数据的子表单。当我单击编辑按钮时,它会自动用所选数据填充框,但是当我进行编辑并尝试保存它时,我收到错误消息:RUN TIME ERROR 3075 SYNTAX ERROR (MISSING OPERATOR) IN QUERY EXPRESSION
整个代码是
Private Sub cmdAdd_Click()
'when we click on button Add there are two options
'1. For insert
'2. For Update
If Me.txt_code.Tag & "" = "" Then
'this is for insert new
'add data to table
CurrentDb.Execute "INSERT INTO KWTable(KW, Source, Code) " & _
" VALUES('" & Me.text_key & "','" & Me.combo_source & "','" & _
Me.txt_code & "')"
Else
'otherwise (Tag of txtID store the id of student to be modified)
CurrentDb.Execute "UPDATE KWTable " & _
" SET KW='" & Me.text_key & _
", Code='" & Me.txt_code & "'" & _
", Source='" & Me.combo_source & "'" & _
" WHERE KW='" & Me.text_key
End If
'clear form
cmdClear_Click
'refresh data in list on form
TableSub.Form.Requery
End Sub
当我尝试调试问题时突出显示的部分是。
CurrentDb.Execute "UPDATE KWTable " & _
" SET KW='" & Me.text_key & _
", Code='" & Me.txt_code & "'" & _
", Source='" & Me.combo_source & "'" & _
" WHERE KW='" & Me.text_key