How do I import more than one file at a time?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to create a new table by importing a tab-delimited text file. However,
I've got a lot of other text files, formatted the same way, which will also
need to be imported into the same table. How do I select more than one file
at a time to import?

Thanks
Jeff
 
I'm not aware of a way to tell Access to import more than a single file at a
time. That said, there'd be no reason you couldn't come up with a procedure
that ran through a list of files and imported them one-by-one.

Consider another approach, however. If you import to a temporary table,
then append from that table into your permanent table, you can import any
number of files (sequentially, of course).

Good luck

Jeff Boyce
<Access MVP>
 
Jeff,

Assuming you have already done it oce manually, so you have saved an
import spec, you can do it at once for all files in a folder through
this simple piece of code:

Sub Import_Files_From_Folder()
Set fs = CreateObject("Scripting.FileSystemObject")
Set fldr = fs.GetFolder("C:\MyFolder\")
Set fls = fldr.Files
For Each fl In fls
DoCmd.TransferText acImportDelim, _
"MySpecificationName", "MyTable", fl.Path
Next fl
End Sub

Replace the folder, spec and table names with the actual ones, and off
you go.

HTH,
Nikos
 
Of no particular importance, just being "nostalgic":

Anybody remember the black, character mode DOS (as in Disk Operating
System, not Denial Of Service!) screens? Well, in one of those, one
could simply type:

Copy *.txt allfiles.txt

and DOS would copy the contents of all .txt (or whatever) files in the
folder in one file... then the import process would be a one step one!
Isn't it funny that some things were easier back then? Anybody tried to
mass-rename files in Windows?

Nikos
 
Back
Top