Importing a LARGE # of .txt files at once

  • Thread starter Thread starter Gary W.
  • Start date Start date
G

Gary W.

Using Windows 98
Access 2002

I have experience using the 'TransferText' action within a
macro to import a single .txt file. I have also used
the 'TransferText' action 10 times within a single macro
to import 10 different .txt. files.

But now I've been asked to import about 1000 .txt files.
All 1000 .txt. files are stored in the same folder on the
network. I need to import all of them into one table
using the same import specifications (because each
contains similar data). The TransferText Action requires
you to enter the exact file name each time. Do I need to
set up 1000 different 'TransferText' Actions or is there a
way I can ask Access to import ALL the .txt files
contained in a certain folder(into the same table)?


Thanks in advance for any assistance you can provide.
Gary W.
 
Convert your macro into a VB module (right click the Macro and choose Save
As). In VB, you can create a loop that will allow you to substitute a
variable for the hard-coded input file specification. Exactly how that loop
is constructed depends on your circumstances. Will all the files be named
in some sequential fashion (File1.txt, File2.txt, etc) or will you have to
use a list or perhaps read the directory itself for the file names. All of
these can be done.

Can you give more specifics? In addition to the above, it would be good to
know the table name, file names (just a sample, not all 1000!), the actual
path you are using, whether you are importing them to an existing table or a
new one, etc.

It would also be helpful to list the converted macro.
 
Back
Top