Importing Data In CSV File

T

Tom

AccessXP --

I am designing an application to import data form a CSV file on a daily basis.
Each line in the CSV file will begin with either A, B or C. I will need to
import the data into three different tables depending on which letter the row
begins with. I'm thinking the way to do this is to use TransferText and import
the file into a temporary table and then run three append queries on the temp
table to put the data into the appropriate tables.

Is this the best way to do this or is there a better way?

Thanks!

Tom
 
V

Van T. Dinh

I thinh you can also "link" to the csv file and it appears as a linked Table
in your Database. You can then use the linked Table as the Datasource for
your Append Queries.
 
R

rkc

Tom said:
AccessXP --

I am designing an application to import data form a CSV file on a daily basis.
Each line in the CSV file will begin with either A, B or C. I will need to
import the data into three different tables depending on which letter the row
begins with. I'm thinking the way to do this is to use TransferText and import
the file into a temporary table and then run three append queries on the temp
table to put the data into the appropriate tables.

Is this the best way to do this or is there a better way?

If the three differing lines of data differ only in whether the first field
is an A, B or
C then the method you outlined is a viable way of automating the task. I
won't ask
why your storing data with the exact same structure in three different
tables.

If the A, B and C lines also differ in structure then your probably looking
at writing
code to read the files, parse out the different lines and add the records to
the correct
tables as you go.
 
M

mike l

Are you familiar w/ VBA? I would write a module to open
the files and run through the records looking at the value
in the first field to determine which table to update. If
you'd like a sample of how to do this email me at
(e-mail address removed) w/ CSV VBA in the subject line! It's
really simple and can be automated so all you have to do
is put the new files into a folder and run.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top