How do I open a text file and parse through it to pull data out?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have to open a text file that is more like a letter than a listing of
columns of data. I need to be able to open this file and then parse through
it looking for specific headers etc to find data that I then need to put in
my Table.

I am trying to do this in a module that can be called from a form.

First, what is the correct command to get to a Text file on the C: Drive and
open it.

Then what is the proper way to move through the document looking for my
data. I am assuming that using the some of the string/character functions
are the way to go with this.

Thanks for any help you can give.
 
First, what is the correct command to get to a Text file on the C:
Drive and open it.

Look up help on the Open statement (not the method!) and it's well
described there. There is also an OpenTextFile method, but I've not used
it as the old Basic functions work so well.
Then what is the proper way to move through the document looking for
my data. I am assuming that using the some of the string/character
functions are the way to go with this.

Again, look up help on Line Input # Statement

For most string comparison, Instr() and Like are your friends. For major
problems you can use a Regular Expression object, but like the man said,
"if you start with a problem and use a regex to solve it, then you have
two problems"...


Hope that helps


Tim F
 
Thanks for the help! I'll give it a shot. I'm a little rusty with MS Access
and I'm finding it hard to get back into it.....I know the lightbulb will go
on again soon enough.

Thanks,
Kath
 
Back
Top