Excel to Access SQL problem

A

Alan

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top