counting files

  • Thread starter Thread starter Bre-x
  • Start date Start date
B

Bre-x

Is there a way on MS Access 2002 count files?

Example

C:\mastercam\apples.mc9
C:\mastercam\apples.mcx
C:\mastercam\oranges.mc9
C:\mastercam\bananas.mcx

I need to tell the user that when he search for apples.* that there is 2
files.

Thank you all

Bre-x
 
You'd need to use VBA to loop through the matching files:

Dim lngCount As Long
Dim strFile As String
Dim strFolder As String

lngCount = 0
strFolder = "C:\mastercam\"
strFile = Dir(strFolder & "apple.*")
Do While Len(strFile) > 0
lngCount = lngCount + 1
strFile = Dir()
Loop
MsgBox "There are " & lngCount & " 'apple' files"
 
Thank you!! It works very well


Douglas J. Steele said:
You'd need to use VBA to loop through the matching files:

Dim lngCount As Long
Dim strFile As String
Dim strFolder As String

lngCount = 0
strFolder = "C:\mastercam\"
strFile = Dir(strFolder & "apple.*")
Do While Len(strFile) > 0
lngCount = lngCount + 1
strFile = Dir()
Loop
MsgBox "There are " & lngCount & " 'apple' files"
 
Back
Top