Read a text file


Question

I have checked the archives ("read text file" = 291 hits) but nothing helped :-( I'll save a long story ... the following is what I have to work with and I need to read it into access :-) or excel :-( . The file is formatted as follows:

Mrs Whoever
Last Active Date: 23/12/1997 12:07:05
Overdue Fines: $3.30                                   Total Bills: $0.00
Total Misc.:  $0.00
                                                       Total Owed: $3.30
Items Overdue: 0
Total claims returned: 0                               Active claims returned: 0

 
Tracey-Anne Whoever
Last Active Date: 16/06/1997 17:15:55
Overdue Fines: $36.00                                  Total Bills: $0.00
Total Misc.:  $0.00> 
                                                       Total Owed: $36.00
Items Overdue: 0
Total claims returned: 0                               Active claims returned: 0

.....

 

Answer

From: Shamil Salakhetdinov <shamil@marta.darts.spb.ru>
To: ACCESS-L <ACCESS-L@PEACH.EASE.LSOFT.COM>
Subject: Re: Read a text file
Date: 9 July 1998 12:51

Steve,

Just typed a template code which can be used to approach your task solution assuming that your file has the fixed structure you described. Just run it supplying your file path to see how it works. Can be used from both MS Access 97 and MS Excel 97(after correction of header lines - options database etc.).

HTH,
Best wishes,
Shamil

P.S. It should be easy to extend this code to convert and store attributes(fields) into the target table


HOME    TOPICS

Copyright © 1998–1999 by Shamil Salakhetdinov.
All rights reserved. Terms of use.

Last updated: October 10, 2006

Published also here at 4TOPS: Read a text file