我正在为在Banking的工作编写vba,以管理Access 2013中的数据,但是尝试运行代码时出现了问题。 File DB here
我以前在互联网上发现的代码是:
Private Sub cmdthem_Click()
If Me.TXTLCNO.Tag & "" = "" Then
CurrentDb.Execute "INSERT INTO db(NOLCTRANSACTION, LCTYPE, LCXKLCNKREF, BENAPPLICANT, AMOUNT, CONTRACTNO, INPUTTER, AUTHORIZER, DATE, STATUS, NOTE) " & _
" VALUES(" & Me.TXTLCNO & ",'" & Me.CBO1 & "','" & _
Me.TXTREF & "','" & Me.TXTBEN & "#,'" & Me.TXTAMOUNT & "',#" & _
Me.TXTCONTRACT & "','" & Me.CBO2 & "','" & Me.CBO3 & "#,'" & Me.TXTDATE & "',#" & _
Me.TXTSTATUS & "','" & Me.TXTNOTE & "')"
Else
'otherwise (Tag of txtID store the id of db to modified)
'CurrentDb.Execute "Update db " & _
" SET NOLCTRANSACTION=" & Me.TXTLCNO & _
", LCTYPE='" & Me.CBO1 & "'" & _
", LCXKLCNKREF='" & Me.TXTREF & "'" & _
", BENAPPICANT='" & Me.TXTBEN & "'" & _
", AMOUNT='" & Me.TXTAMOUNT & "'" & _
", CONTRACTNO='" & Me.TXTCONTRACT & "'" & _
", INPUTTER='" & Me.CBO2 & "'" & _
", AUTHORIZER='" & Me.CBO3 & "'" & _
", DATE='" & Me.TXTDATE & "'" & _
", STATUS='" & Me.TXTSTATUS & "'" & _
", NOTE='" & Me.TXTNOTE & "'" & _
" WHERE NOLCTRANSACTION=" & Me.NOLC.Tag
End If
'clear form
cmdclear_Click
'refresh data in list
db_subform.Form.Requery
End Sub
但是当我尝试运行此命令时,它总是错误地声明INSERT INTO db
我的表的名称是db,上面有所有字段
您能找出我的错误吗?谢谢你,问候