View Full Version : Access 2003: Import Multiple Text Files with different filenames using a Macro


Aimminn
06-23-2010, 08:39 AM
Hi Everyone-

I am using Access 2003, and I am trying to import several text files from the same location. Each text file will have a different name. For example:

From location:
Y:\Incentive Data Reports\Rejects\UPLOAD

I want to upload the following files:
HBACK-Rejects_06162010.txt
HBACK-Rejects_06172010.txt
HFAIR-Rejects_06182010.txt
HFair-Rejects_06222010.txt

The files are all formatted the same way, and I've created an import specification called (DM_Rejects). I want the files to be uploaded to the Table named "LoadFiles" in Access.

The file names will change daily.

Does anyone have any suggestions?

Thank you!

ghudson
06-23-2010, 12:20 PM
Welcome to the forum.

You will have to use VBA. Search the forum for there are tons of examples on how to do what you want.

You will want to import each file into a temp table, run some verifications to ensure the data is ok then append the imported data to your main table. I also suggest that you move the imported files into a "processed" directory. Remember to purge the temp table before you import the files.