Link to home
Start Free TrialLog in
Avatar of Aaron Greene
Aaron GreeneFlag for United States of America

asked on

Reading data from a csv file into access table

I would like to build a database application that I can use to manipulate data read from a csv file.  The csv file is a data dump from a Wonderware HMI application.  It contains all of the tags used in the application grouped by a keyword.  As the csv file is read, the application will need to determine if the row of data is a header row or a data row.  If it is a header row, the first column name will begin with a keyword.  I would like to use this keyword to determine the table that the subsequent rows should be imported into.  I have attached a spreadsheet that shows the raw csv file and an edited to show the logic that I have been using.  I have to do this process for every project that I work on, so it would save me a huge amount of time if I could automate this.
ee.xlsx
Avatar of als315
als315
Flag of Russian Federation image

It is not a csv file, you should read it line by line from vba. Can you upload original source file and structure of access table?
ASKER CERTIFIED SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aaron Greene

ASKER

I'm not sure that I follow your line of thought.  What is the intFileDesc variable used for?
That's the file handler. You can have more than one file open, then you'll have to differentiate between them.

/gustav
Okay, I see what you are doing there.  Now, I will need to take the data read from the csv and manipulate it so I can add it to the target tables.  I would like to use the split function to break the strTextLine instead of using a bunch of text functions.
That's a viable option. The code origins from the time before Split.

/gustav