我有一个将数据写入链接SQL表的表单,其中一个函数是EDIT函数,但是当我进行编辑并重新提交数据时,我收到错误
Run Time Error 3073 Operation Must Use an Updateable Query
我之前在表格所在的数据库中的普通Access表中使用过此代码并且工作正常,我是否需要对代码进行一些更改,因为它正在编辑链接SQL表上的数据?代码如下?
CurrentDb.Execute "UPDATE dbo_AC_CD_Data_Form " & _
"SET EmployeeID='" & Me.txtEmpID & "'" & _
", EmployeeName='" & Me.txtEmpName & "'" & _
", Gender='" & Me.cboGender & "'" & _
", EEOC='" & Me.cboEEOC & "'" & _
", ReadinessLevel='" & Me.cboReadyLvl & "'" & _
", Division='" & Me.cboDivision & "'" & _
", Center='" & Me.txtCenter & "'" & _
", EmployeeFeedback='" & Me.txtFeedback & "'" & _
", DevelopmentForEmployee='" & Me.txtDevelopment & "'" & _
", Justification='" & Me.txtJustification & "'" & _
", Changed ='" & Me.cboChanged & "'" & _
" WHERE EmployeeID='" & Me.txtEmpID & "'"
答案 0 :(得分:2)
删除Access中的链接表并再次链接。向导应该要求您提供主键。选择复合主键的字段。
请注意,原始表没有必要具有pk(这通常发生链接视图)。