2
我試過將strSQL重新放回到一個字段中,一切正常。只要我添加第二個字段,我開始收到錯誤。這告訴我參考是正確的。我已經嘗試了很多不同的()的空間,沒有運氣。INSERT INTO語句中的語法錯誤RTE'-2147217900(80040e14)':
?strSQL
INSERT INTO tbl_buyer_column (ship_id, aels_id, buyer_wss, column, date_created)VALUES(23, 13, K, 1, #04/17/2015#)
Public Sub fun_insert_into(lngship_id As Long, lngAels_id As Long, strBuyer_wss As String, lngColumn As Long, datDate_created As Date)
Dim strSQL As String
Dim adoCon As ADODB.Connection
Dim adoCmd As ADODB.Command
Set adoCon = CurrentProject.Connection
Set adoCmd = New ADODB.Command
strSQL = "INSERT INTO tbl_buyer_column (ship_id, aels_id, buyer_wss, column, date_created)" & _
"VALUES(" & lngship_id & ", " & lngAels_id & ", " & strBuyer_wss & ", " & lngColumn & ", " & SQLDate(datDate_created) & ")"
With adoCmd
.ActiveConnection = adoCon
.CommandType = adCmdText
.CommandText = strSQL
.Execute
End With
adoCon.Close
Set adoCon = Nothing
Set adoCmd = Nothing
End Sub
不要不同意你所說的任何話,但在大多數情況下,最好避免首先使用保留字。 – Casey
需要[]和'around buyer_wss。 – Kaw4Life