Excel to Access SQL problem
Hi, I am trying to use a SQL string using INSERT INTO to populate a table in
Access. This works fine for all text based columns but returns a runtime error for columns with numbers. I have tried omitting thew single quotes but am still having no luck. Can someone help..please. The code I'm using is below; ReDim myfield1(LBound(myfield1) To UBound(myfield1), 1 To 4) For x = LBound(myfield1) To UBound(myfield1) For y = 1 To 4 myfield1(x, y) = mysheet.Cells(x + 1, y).Value Next y mysql = "INSERT INTO Backups(Client,Policy,Schedule,Media) " mysql = mysql + "VALUES ('" & myfield1(x, 1) & "','" & myfield1(x, 2) & "','" & myfield1(x, 3) & _ "','" & myfield1(x, 4) & "') " command.CommandText = mysql MsgBox mysql command.Execute |
All times are GMT +1. The time now is 06:10 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com