PDA

View Full Version : VBA to import a csv file to a table



Marcster
07-07-2009, 12:39 PM
Does anyone have any code for importing a 51 column no headings csv file to an access table?

OBP
07-08-2009, 05:42 AM
I have used this
DoCmd.TransferText acImportDelim, , "temptable", "C:\Access\cps-trans-KI101-2009-02-13.csv", false

Marcster
07-08-2009, 11:36 AM
Thanks OBP, been coding the DoCmd way.
Found out that in Access 2007 macro, lots of them are not there by default!.
Have to tell Access to show all 70 of them, then I can use them and use the convert to vba code function ;-)

CreganTur
07-13-2009, 01:54 PM
For .CSV files you generally have to setup a specification(or schema.ini file) in order to have your data consistently loaded into a table via TransferText.

You can setup one automatically bu manually going through the File->Import routine. Just check the advanced options near the end to save your specs. It's been a while since I've done this, so I can't be more specific a this time... sorry.


Found out that in Access 2007 macro, lots of them are not there by default!.
*shudders* I refuse to program with Macros because of their vast limitations.