Visual Basic / Access Question

imspartacus

New Member
Joined
Jan 26, 2003
Messages
16
Hi

I'm trying to load an excel .csv file into access through a vb program I'm writing. The relevant code is as follows :

Set db = OpenDatabase("c:dellsecdellsec.mdb")
sqlStr = "load from '" & activefile & "' insert into csv_imp"
Set rs = db.OpenRecordset(sqlStr)

The sqlStr string is :
"load from 'C:dellsecFCC000061_20030114.csv' insert into csv_imp"

Once the "Set rs = " line is processed I get an error saying that the JET DB engine cant find the table or query. The table is in the db so I'm thinking there's a problem with the SQL. Does Access support "Load from" in SQL ? "LOAD" doesn't appear to be a reserved word. Heeeeeeeeeelp.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
The command to use is TransferText. Have a look at the help file for more info.

DoCmd.TransferText acImportDelim, , "TableName", "PathnameFilename.csv", True

David
 
Upvote 0

Forum statistics

Threads
1,221,506
Messages
6,160,205
Members
451,630
Latest member
zxhathust

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top