0
似乎很容易,但我沒有辦法實在不行,它給了錯誤味精(語法錯誤INSERT INTO語句中)..SQL INSERT INTO語句不行VBA
Call Connect_to_db
strSQL = "INSERT INTO Table2 (Name, StaffNumber , Title , Number , ext , Nationalty , Section , Sector , Side , Department , Civil , Job_title) Values ('" & addName.TExt & "', " & Val(addStaffID.TExt) & ", '" & addTitle.TExt & "', " & Val(addNumber.TExt) & " , " & Val(addExt.TExt) & " , '" & addNation.TExt & "', '" & addSection.TExt & "', '" & addSector.TExt & "', '" & addSide.TExt & "', '" & addDept.TExt & "' , " & Val(addCivil.TExt) & ", '" & addJob.TExt & "' )"
Debug.Print strSQL
cn.Execute strSQL
MsgBox ("Data Added to the Database")
Call Close_db
所有數據類型的文本除(StaffNumber,分機,號碼,民用)號碼
我相信我需要每個之前的修剪,但我不認爲這是問題的原因。
你能分享生成的SQL? ''Debug.Print strSQL' – Sam
INSERT INTO Table2(Name,StaffNumber,Title,Number,Ext,Nationalty,Section,Sector,Side,Department,Civil,Job_title)Values('Ali',55,'Mr.',54654, 454,'KUW','風險','COM','市場',1251,'主管')@Sam – SQB
國籍或國籍? – 2013-11-28 08:24:23