How do I import multiple csv files with identical format?

  • Thread starter Thread starter Kent
  • Start date Start date
K

Kent

I have a program that creates a log every day in csv format.
I was hoping there was an easy way to import them all at once to a single
access table but cannot seem to figure this out. I do know how to import
them 1 at a time. I do not know any programming? Is there an easy way?
 
How to Import all Files in a Folder:

Private Sub btnImportAllFiles_Click()
'procedure to import all files in a directory and delete them.
'assumes they are all the correct format for an ASCII delimited import.
Dim strfile As String

ChDir ("c:\MyFiles")
strfile = Dir("FileName*.*")
Do While Len(strfile) > 0
DoCmd.TransferText acImportDelim, "ImportSpecName", "AccessTableName",
"c:\MyFiles\" & strfile, True
'delete the file (consider moving it to an Archive folder instead.)
Kill "c:\MyFiles\" & strfile
strfile = Dir
Loop

End Sub
 
Back
Top