Browse [Find a directory or file] inc subfolder files

joepineapples

Registered User.
Local time
Today, 11:05
Joined
Apr 28, 2006
Messages
29
Hi All

I've just been looking at this great example on file browsing (as produced by ghudson) and wanted to use one of the examples - either fScanDirSelectFileFromCombo or fScanDirSelectFileFromTable.

http://www.access-programmers.co.uk/forums/showthread.php?t=97787&highlight=dialog+box+folder

My query is this - I would like the search path to include documents found within sub folders of that path - is there a way to add these to either of the above examples?

Many Thanks

JP
 
I found what I was looking for.

I modified the code for the combo box example - see below.

Code:
Public Function Update_cbSelectFile()
On Error GoTo Err_Update_cbSelectFile

    Dim sPath As String
    Dim sFileList As String
    Dim sFileName As String
        
    sFileList = ""
    [COLOR="Blue"]sFileName = Dir(, vbDirectory) ' this will show just the Folder names
'   sFileName = Dir(cPath, vbDirectory) this will show all the files and the folders[/COLOR]    Do While sFileName <> ""
                
            sFileList = sFileList & sFileName & ";"
            sFileName = Dir
        
    Loop
    
    Me.cbSelectFile.RowSource = sFileList
    Me.cbSelectFile.Requery

Exit_Update_cbSelectFile:
    Exit Function
    
Err_Update_cbSelectFile:
    If Err.Number = 2176 Then 'The setting for this property is too long
        MsgBox "Combo box can not contain more than 255 records.  No records will be displayed.", vbCritical, "Record Source Error"
    Else
        MsgBox Err.Number & " - " & Err.Description
        Resume Exit_Update_cbSelectFile
    End If
    
End Function

For my needs I used the above modification to populate a combo box with just the folders from there I used the combo box to filter a listbox to show just the files.

Hopefully this makes sense.

JP :)
 

Users who are viewing this thread

Back
Top Bottom