The TransferText method requires the specific, full, filename. No wildcard. You need to make the file name a variable that you fill with each file name as you loop through the files in the directory.
However, the loop is NOT of a recordSet, it uses FSO (File System Object) or the Dir
Here is a sample database that shows three imports. One uses a loop. I've also attached 4 files to use with the sample.
The third sample also logs each file and assigns a sequence number which is appended with the data so for each row in the data table, you can tell by looking in the log file what source file that row came from. The example also raises an error if you try to import the same file more than once as well as complaining about but ignoring any file in the folder without the "known" extension. This example imports both .csv and excel files to the same target table. Of course, they must have the same format for this to work. If you want to import .csv or .txt files, you MUST create an ImportSpec first for your specific file format. This is done by importing the file ONCE manually so you can setup through the wizard and define the column types, etc. Then using the Advanced button, you save the file spec before exiting the wizard. This is the "old" style spec and it is much more flexible than the "new" spec which gives you a "save import" option.