Importing Multiple Files

  • Thread starter Thread starter Artistyc
  • Start date Start date
A

Artistyc

I've been attempting this project for a while now and i
haven't figured out how to do this. I have a large
number of .dbf files. All these files have a sinlge
table that has completely identacle feild names,feild
sizes, and data formats. The only differance is the
information in the feilds and the names of the files. I
want to import all the information into a single access
database. I thought it should be simple to import them
or merge them or Link them but regardless of how i do it
I have to select every single file individually and do
this task on its own. Is there a way to Import large
number of files as a group.

(Please note that the total number of files i'm dealing
with is around 10,000 .dbf's)
 
You can do this in a VBA code procedure. Put all the files into one folder.
Then use code similar to the following in a module:


Private Sub GoGet10000DBFFiles()
Dim strFileName As String
Const strPath As String = "C:\MyFolder\"
Const strTableName As String = "TableToGetImportedRecords"
strFileName = Dir(strPath & "*.dbf")
Do While strFileName <> ""
' run an append query here that uses strPath & strFileName as the
' location of the file and that appends the data to your table
strFileName = Dir()
Loop
End Sub
 
Back
Top