Import multiple csv in one process

  • Thread starter Thread starter TJ
  • Start date Start date
T

TJ

newbie question:
We download data from a pharmacy dispencing system. Each
day's activity is archived in a commma delimited file: the
first 8 characters of the file name is unique, .pyx
extension on all files. I have created a macro that will
import *.pyx. Works great for one day's data. The users
prefer to do this process weekely or even bi-weekly.

Question: (know very LITTLE VB, rely heavily on batch
files and macros...)
How can I programatically combine these files into one
or
Import each in it's turn?

TIA
tj
 
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