Full Version: Importing A File With A Header
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
CarlM
Hello.

My file looks like this:

H01052012 01052012
A A A000000099000000000000000179OSTK
A A P000000193000000025000000418OSTK
A A Z000000025000000023000000078OSTK

I currently need to remove the header and then import the file into my database.

The header contains the file date - which I would lke to have added as a field in my table with format YYYYMMDD. For example 'H01052012 ' would be 20120105.

I also do not want that header to be in the database.

Is there a way to do this ?
Jeff B.
One-time or repeatedly?

One-time, just import it and delete the first record.
CarlM
Thanks. I import the file daily. If it matters, I am using Access 2003.
Jeff B.
Thanks for the clarification.

"... I import the file daily ..." ... from where? What data source? What data format?
CarlM
Thanks.

The file is imported from a location on my network. It is a csv file. MAybe I should clrify the steps I go through.

I open a csv file. The data looks like this...

H01052012 01052012
A A A000000099000000000000000179OSTK
A A P000000193000000025000000418OSTK
A A Z000000025000000023000000078OSTK

I then manually remove the 1st row and save the file onto my network.

I then use an Access import macro (defining field names and parsing the data) to import the file and append it to an existing table.

I then manually use a query to add the date to these new records.

What I am trying to accomplish is using Access to import the file (with the 1st row - H01052012 01052012), use characters 2 thru 9 in the 1st row of data (which is MMDDYYYY) for the value in all the new records 'date' field formatted YYYYMMDD.

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.