counting files

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
 
D

Douglas J. Steele

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"
 
B

Bre-x

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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top