正在开发包含Userform和Table的Employee Daily时间跟踪器,我希望Employees填写表单并点击添加按钮以将数据从表发送到表。我写了以下代码,这是一个错误:
runtime error 3134 insert into statement
代码如下:
Private Sub ADD_Click()
CurrentDb.Execute "INSERT INTO utilizationdata(DU-Date, [FirstName], US_Tax_Group)" & _
"VALUES(" & Me.Text5 & ",'" & Me.Text7 & "'," & _
Me.Combo25 & ",)"
PrForm.Form.Requery
End Sub
答案 0 :(得分:0)
将DU-Date括在括号中:[DU-Date]
另外,您可能需要附上"#"日期,删除昏迷并添加空格:
CurrentDb.Execute "INSERT INTO utilizationdata ([DU-Date], [FirstName], [US_Tax_Group]) " & _
"VALUES(#" & Me.Text5 & "#,'" & Me.Text7 & "'," & _
Me.Combo25 & ")"
在查询构建器中构建查询更容易,然后用变量替换数据。