Every now and then I come across a problem with an old system one of my colleagues has developed. They tend to have thousands of lines of code to do a simple thing like importing a csv file.
Currently the vba process is:
- open excel application
- create new worksheet
- populate the csv file
- into excel add the header names to the file
- save the worksheet as a new excel file
- imports the file into the access data project sql table.
- Process the data
What I want to do with it is:
- import the csv to the table (Like the get external data function)
- process the data
I have had a quick search and cannot see any easy methods of just sucking the file into the table.
Any help would be appreciated.
Thanks
Paul
There is an easier way to import a CSV! You can use the Microsoft Text Odbc Driver.
You change from a Select to an INSERT INTO combined with a SELECT and there you are.
There are some settings you can do in the registry, in the key
\\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Text:Format: TabDelimited, CSVDelimited, Delimited(X) where X=some char
FirstRowHasNames: 0,1
CharacterSet: OEM, ANSI