Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 152
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access to Excel problem raviyah Excel Discussion (Misc queries) 4 October 8th 08 03:18 PM
Excel to Access Problem ostate2007 Excel Discussion (Misc queries) 1 June 28th 06 09:21 PM
Started out as an Access problem. Now an Excel problem RobertM Excel Discussion (Misc queries) 2 April 26th 06 07:30 PM
Access to Excel problem? diofan56 Excel Discussion (Misc queries) 0 February 20th 06 05:20 PM
excel to access problem keithl816 Excel Discussion (Misc queries) 9 November 30th 05 11:52 PM


All times are GMT +1. The time now is 10:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"