Manipulate a text file

N

Newbie

Hi
I have a fixed width text file with which I would like to compare the no. at
position 20 with the result of a query. Is this possible? if so where do I
begin?

Eg Query returns result
Job = 00404123
Op No = 1
Rate = 2

Text File
L004041230001WC1 1

Pos 2 to 9 = Job
Pos 10 to 13 = Op No
Pos 14 to 19 = info
Pos 20 = Rate

Where Job and Op No are the same (text file and query) and the Rate is
different I want to update the Pos 20 of the text file with the rate
returned in the query.
 
R

Ron Weiner

Consider importing the text file into a table with the structure you posted.
This way the values will be easily available via a query where you join the
imported table with your existing table on the Job and OP fields. Of course
this assumes that the combination of the job field and the field OP return
only one record.

So the process looks like this

Delete all records in the new table the holds the text file
Import the text file to the new table
Run any / all updates to the new table
Export the new table back to a fixed with file

Ron W
 
R

Ron Weiner

Samd way you imported it, jyst in the other direction. Something like

docmd.TransferText
acExportFixed,"ExportSpecName","TableName","\\share\path\Filename.txt"

Will get it done. Check out all of the options for docmd.transfertext in
help.

You will need to create an Export Spec, which you can do by manually
exporting the table from the Database window (File | Export). Hit the
advanced button and save the export specification when you are happy with
the exported text file.

Ron W
 

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