Question on importing text file

G

Guest

I currently use 4D DB software and Im looking into possibly switching to
Access 2003 (due to user familiarity with access).
I have never used access and would like to know if it is possible to import
a flat text file (undelimited) into access.

This is the format of the file I need to import:

1704 38894 Sft-01 ICR-03 Clerk-00 02/19/05 12:05PM
13.089G @1.909 Fuel-01 $ 24.99 Pump-02 Club-0 odo-24763 aux-0990

Total 24.99
Paid 24.99 Club 0000049xxxxx000 Auth# SCFFFF
Change 0.00

Unfortunatley the POS that generates this file cannot export it in any other
format.

With 4D I simply use its parsing feature to pull out each field. Does Access
have a similar feature? Is there a way I can import this into Access? a
typical text file will contain an average of 50-150 blocks such as the one
above.

Any help will be greatly appreciated.
Thank You
JEM
 
J

John Nurick

Hi JEM,

Access's built-in text import routines only handle common-or-garden text
files in which every line has the same structure.

But there'd be no real difficulty in reading and parsing files such as
you describe. If the records match your sample I'd do it by slurping the
whole file into a string variable and then using the VBScript regular
expression engine (easily used within Access VBA code) to parse it.

If the records include a variable number of detail lines it may be
necessary to read the file line by line and parse each line according to
its context as well as its contents.
 

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