某些查询表达式中的运行时错误' 3075':"语法错误(缺少运算符)"

时间:2015-04-19 16:26:53

标签: vba access-vba

Private Sub cmdSendOrder_Click()
    'add data to table
    CurrentDb.Execute "INSERT INTO OrderSummary(OrderNumber, SupplierCode, DateOrdered, EmployeeNumber) " & _
          " VALUES (" & Me.txtOrderNumber & "','" & Me.cboSupplierCodeO & "','" & Me.txtDateO & "','" & Me.txtEmployeeO & "') "
    'refresh data on list of form
    OrderSummarySub.Form.Requery
End Sub

我的代码遇到运行时错误,说它在某些查询表达式中有语法错误(缺少运算符)。我很确定我上面的名字是正确的。

1 个答案:

答案 0 :(得分:1)

您在Me.txtOrderNumber之前缺少第一个单引号:

"INSERT INTO OrderSummary(...) VALUES ('" & ...