S
Stephen Lynch
I saw the code in this forum and modified it, however, I searched and cannot
figure out 2 things, 1) how to limit the import of file names to only *.txt
and *.csv and how to import from multiple directories.
so I want to import all *.txt and *.csv from the following folders
C:SLWIN\1, C:SLWIN\2, C:SLWIN\3, and WIN\4.
Thanks in advance I will keep searching.
Function ImportFileNamestoTable()
Dim strSQL As String
Dim strFileName As String
Const conFolder As String = "C:\SLWIN\"
strFile = Dir(conFolder & "*.*")
Do While Len(strFile) > 0
strSQL = "INSERT INTO tblImportedFileNames (FileName) " & _
"SELECT """ & conFolder & strFile & """;"
CurrentDb.Execute strSQL, dbFailOnError
strFile = Dir$()
Loop
End Function
figure out 2 things, 1) how to limit the import of file names to only *.txt
and *.csv and how to import from multiple directories.
so I want to import all *.txt and *.csv from the following folders
C:SLWIN\1, C:SLWIN\2, C:SLWIN\3, and WIN\4.
Thanks in advance I will keep searching.
Function ImportFileNamestoTable()
Dim strSQL As String
Dim strFileName As String
Const conFolder As String = "C:\SLWIN\"
strFile = Dir(conFolder & "*.*")
Do While Len(strFile) > 0
strSQL = "INSERT INTO tblImportedFileNames (FileName) " & _
"SELECT """ & conFolder & strFile & """;"
CurrentDb.Execute strSQL, dbFailOnError
strFile = Dir$()
Loop
End Function