G
Guest
Assume a folder structure of C:\Test, which contains a subfolder called "ABC"
In the C:\Test folder, I have an Access db with a VBA module in it. In the
C:\Test\ABC subfolder I have a number of .csv files.
Can someone tell me what flaw in my logic (or my VBA skills) causes the
running of this code from that module to always return my message, "There
were no files found in C:\Test\ABC" (that is, to be unable to find the .csv
files in the ABC subfolder)?
Dim strPathToDB As String
Dim fs
Dim iCtr As Integer
Dim iNumFiles As Integer
strPathToDB = Application.CurrentProject.Path
Set fs = Application.FileSearch
fs.LookIn = strPathToDB & "\ABC"
fs.FileName = "*.csv"
iNumFiles = fs.FoundFiles.Count
If iNumFiles = 0 Then
MsgBox "There were no files found in " & fs.LookIn
Else
MsgBox "There were " & iNumFiles & "files found in " & fs.LookIn
End If
Thanks.
In the C:\Test folder, I have an Access db with a VBA module in it. In the
C:\Test\ABC subfolder I have a number of .csv files.
Can someone tell me what flaw in my logic (or my VBA skills) causes the
running of this code from that module to always return my message, "There
were no files found in C:\Test\ABC" (that is, to be unable to find the .csv
files in the ABC subfolder)?
Dim strPathToDB As String
Dim fs
Dim iCtr As Integer
Dim iNumFiles As Integer
strPathToDB = Application.CurrentProject.Path
Set fs = Application.FileSearch
fs.LookIn = strPathToDB & "\ABC"
fs.FileName = "*.csv"
iNumFiles = fs.FoundFiles.Count
If iNumFiles = 0 Then
MsgBox "There were no files found in " & fs.LookIn
Else
MsgBox "There were " & iNumFiles & "files found in " & fs.LookIn
End If
Thanks.