Link to home
Start Free TrialLog in
Avatar of johnnyg123
johnnyg123Flag for United States of America

asked on

process text file in access 2003

I am writing an access 2003 application that needs to process data in a text file that is sent from a vendor each month.  (I have attached a sample with names changed to protect the innocent)

The text file is tab delimited and with have the same format column wise.   The row count will be different each month

My first thought was to import the text file and save as an excel spreadsheet but wasn't sure of the best way to do that.

I am open to other ideas as well
testdata.txt
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

That file does not appear to be tab delimited.
Avatar of johnnyg123

ASKER

Sorry .... I was working with multiple vendor files



you are correct....this file is not tab delimited.  


When I was manually opening with excel I was allowing the conversion wizard to use fixed width

The wizard was coming up with 9 columns

There will be a little manual intervention and the first 2 rows and the last row will be deleted
So are you saying that the file you posted is the raw data?

You always should endeavor to avoid any unnecessary "conversion" steps and try to import the file directly to Access...

So if it were me, I would ask that whatever system creates these files be structured such that the first row and the totals are stripped out, and the file be saved as a true delimited file before hand.

Many people just say "This is the way I get the file".
But many times it can be modified at the source to be whatever you request, .
It never hurts to ask... (especially it save you from *Forever* performing the intermediate step of converting it to Excel)

That being said you find an expert here willing to help you create an automated system in Excel to clean the file.

JeffCoachman

I totally agree with Jeff but, even if you can't get the output changed, I don't see the point in involving Excel. You can use straight File I/O to create a new textfile without the first 2 and last lines, then import directly into Access with a predetermined import spec, unless my memory of Access is completely failing me - and I'm sure someone will correct me if so :)
Rory
rorya

Hey buddy!
;-)

The Access import Wiz will ask if "First row contains field names," but won't ask if the second row contains them...
;-)
I also don't know of an easy way to remove the totals in the last row (by using the Wiz and/or an Import Spec).
(Although I guess in the Big picture it may not be such a big deal to leave the totals in, ...it just makes for an imperfect import)

Then there is still the issue of converting the file, as it stands, to a real Tab delimited file.

That's why I thought one of the Excel Experts might be able to come up with something to automate the Cleaning of this data.
(...that is unless the file can be manipulated at the source)

...making an interface to select the file would be another issue...

;-)

Jeff
Thanks for all the posts ... really appreciate it

I totally agree that it would be best to have the file in a clean format.

Most of the time I am successful of using my powers of persuasion to accomplish this.

However, as I mentioned earlier this is a file that comes from an outside vendor and they are unwilling to change the format.  (I diid make a comment to the effect of perhaps we should switch vendors but this fell on deaf ears :-))

So....I am stuck with the file format

Since my last post I have started down the path of just reading the text file using the file scripting object and pulling the data out that way in conjunction with the some string functions.

So far so good.

I did not mention earlier that one of the complaints is that the process currently in place is too manual

even the use of running through wizards is being challenged.  just exploring different options
ASKER CERTIFIED SOLUTION
Avatar of als315
als315
Flag of Russian Federation 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
Thanks again for all the posts!

My initial thought was to use excel but as Rory correctly pointed out that thought was not a good one.

Thanks to als315 for providing a solution that is indeed the better approach