Importing CSV File to Access Table

P

PeteVTX

Can anyone help?

Our Network Switch produces a range of traffic reports in CSV format -
however we need to manipulate this data in Access. Therefore I need to import
one of the CSV reports into an Access application that produces the results
we need. I know I can use the following to do this:

CurrentDb.Execute "Delete * from tbl_egressByZone"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel3, _
"tbl_egressByZone", "C:\Documents and Settings\userName\Desktop\DT
Files\Egress By Zone.csv", True

However the CSV file contains 4 rows prior to the field heading rows that
are superfluous. Of course I can manually remove these rows from the CSV file
before I run the application but I wondered whether I could do this
automatically from within Access before importing the file.

Any help appreciated

Regards

Pete
 
K

Klatuu

Is this working? Using TransferSpreadsheet on a csv file should produce an
error 3274.
You should be using the TransferText. With TransferText, you can specify
which columns to skip or import and define their names and data types.
What you do is go through the process once of doing a manual imort and after
you have chose the file, click on Advanced in the import wizard. There you
can set it up like you want it. The Click Save As and give the specification
a name. Then in your code you can use the name of the specification and it
will import it like you want it.
 

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