运行时错误3134 - INSERT INTO语句中的语法错误(MS Access VBA)

时间:2015-03-30 08:56:25

标签: vba ms-access

我更改了数据表中的输入并添加了"来自"和"到"到表和查询,但现在我得到错误

  

运行时错误3134 - INSERT INTO语句中的语法错误

我的陈述:

db.Execute "INSERT INTO Temp ( LoadNum, ReferenceNum, ActivityDate, Appointment, From, To, OriginCity, OriginCountry, DestinationCity, DestinationCountry, [Carrier Name], [Load Status] ) " _
                & "SELECT Data.LoadNum, Data.ReferenceNum, Data.ActivityDate, Data.Appointment, Data.From, Data.To, Data.OriginCity, Data.OriginCountry, Data.DestinationCity, Data.DestinationCountry, Data.[Carrier Name], Data.[Load Status] " _
                & "FROM Data " _
                & "WHERE [Data].[CarrierCode]='" & cNum & "';"

我已经盯着这一段时间,但我找不到错误。有没有人有想法?

1 个答案:

答案 0 :(得分:0)

您可能需要在括号中至少包含这些保留字:

.., [From], [To], ..

完整列表: Reserved words in Access SQL