VBA INSERT INTO语句(MS Access)

时间:2014-01-22 12:11:57

标签: vba

我遇到了以下问题,并收到运行时错误3134

LastOrderNumber = DMax("Order", "Model_types")
NewOrderNumber = CLng(LastOrderNumber + 1)

CurrentDb.Execute "INSERT INTO Model_types (Order) " _
            & "VALUES (" & NewOrderNumber & ")"

Model_types中的“Order”字段是Long Integer。

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:2)

订单是保留字。您应该将您的陈述更改为:

CurrentDb.Execute "INSERT INTO Model_types ([Order]) " _
        & "VALUES (" & NewOrderNumber & ")"