Importing a folder of text files - bits of them, at least!

A

Andy

Hi
I have a folder of text files (a few thousand) and I want to either
take the relevant bits of them into Access (one per record, memo
field) based on what's in the file or to import all of them into
Access and then delete the irrelevant bits.
As an example, I want to grab the data after <div
class="ext_description"> (which appears in all of the files (they were
html)) and put it into records in a table. I don't know whether to
remove the irrelevant bits from the files before or after import.
Thanks for any help you can suggest!
 
A

Andy

Hi
I have a folder of text files (a few thousand) and I want to either
take the relevant bits of them into Access (one per record, memo
field) based on what's in the file or to import all of them into
Access and then delete the irrelevant bits.
As an example, I want to grab the data after <div
class="ext_description"> (which appears in all of the files (they were
html)) and put it into records in a table. I don't know whether to
remove the irrelevant bits from the files before or after import.
Thanks for any help you can suggest!

Hi - again
I've now managed to write an Access query to extract the correct
information from the text file. I just need an easy way to import txt
files into individual records of a table. I have a folder full of them
to get in.
Cheers!
 
J

John W. Vinson

I've now managed to write an Access query to extract the correct
information from the text file. I just need an easy way to import txt
files into individual records of a table. I have a folder full of them
to get in.

You'll need some VBA to do this: the Dir() function will let you step through
all the files in the directory. I'd imagine you could have a VBA loop using
Dir() to do so, and use TransferText to link to each file in turn, upon which
you can run your query.

See the VBA help for Dir, and post back if it's not clear.
 
A

Andy

You'll need some VBA to do this: the Dir() function will let you step through
all the files in the directory. I'd imagine you could have a VBA loop using
Dir() to do so, and use TransferText to link to each file in turn, upon which
you can run your query.

See the VBA help for Dir, and post back if it's not clear.

Thanks for the pointer, John.
Andy.
 
D

De Jager

Andy said:
Hi
I have a folder of text files (a few thousand) and I want to either
take the relevant bits of them into Access (one per record, memo
field) based on what's in the file or to import all of them into
Access and then delete the irrelevant bits.
As an example, I want to grab the data after <div
class="ext_description"> (which appears in all of the files (they were
html)) and put it into records in a table. I don't know whether to
remove the irrelevant bits from the files before or after import.
Thanks for any help you can suggest!
 

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