Member Avatar for snowmman99
snowmman99

I am trying to import several files to access. I have the code to search the C:\ drive but I need to look thru all the folders also. Below is what I have so far the works. Thanks in advance for any help. Wayne

Dim strfile1 As String
Dim strfile2 As String
Dim strmsg As String
strmsg = "All Incoming files have been Successfully Imported and Deleted!"
ChDir ("C:\")
strfile1 = Dir("*.sta")
strfile2 = "status.txt"
Do While Len(strfile1) > 0
FileCopy strfile1, strfile2
DoCmd.TransferText acImportFixed, "Specifiation", "tblName", strfile2, False
Kill "C:\" & strfile1
Kill "C:\" & strfile2
strfile1 = Dir
Loop
MsgBox (strmsg)