Another approach is to use the Shell command to execute a DIR /s /on >temp.txt. Then read the temp.txt into a temporary table. ...
'create a directory listing by writing a batch file and executing it
sCommand = "dir " & lcBase_Path & "*.mdb /s /b /o-s >" & APP_PATH & "dir_list_mdb.lst"
Open APP_PATH & "dir.bat" For Output As #1
Print #1, sCommand
Close #1
wHandle = Shell(APP_PATH & "dir.bat"

DelayTime 10 'delay to wait for the directory list, required becasue Shell command is asyncronous.
appLoop wHandle
Open APP_PATH & "dir_list_mdb.lst" For Input As #1 'open the directory list file and load table
Do While Not EOF(1)... etc...
Public Function DelayTime(PauseTime As Integer)
Dim start
start = Timer ' Set start time.
Do While Timer < start + PauseTime
DoEvents ' Yield to other processes.
Loop
End Function
Sub appLoop(wHandle As Long)
On Error GoTo errorhandler
Do While 1
AppActivate wHandle, False
Loop
errorhandler:
Exit Sub
End Sub
Or use DIR()
From Help... here is how to loop through with DIR()
' Display the names in C:\ that represent directories.
MyPath = "c:\" ' Set the path.
MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry.
Do While MyName <> "" ' Start the loop.
' Ignore the current directory and the encompassing directory.
If MyName <> "." And MyName <> ".." Then
' Use bitwise comparison to make sure MyName is a directory.
If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
Debug.Print MyName ' Display entry only if it (OR Write to a table)
End If ' it represents a directory.
End If
MyName = Dir ' Get next entry.
Loop
Steve Medvid
"IT Consultant & Web Master"
web page under development...