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

  • Thread starter Thread starter Andy
  • Start date Start date
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
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!
 
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.
 
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.
 
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!
 
Back
Top