Full Version: Include only Certain Folders in a ListBox
UtterAccess Forums > Microsoft® Access > Access Forms
kdw3
Hello,
ight now I have a list box that shows all the folders in a directory using the following:
CODE

    Set fs = CreateObject("Scripting.FileSystemObject")
    Set MainDir = fs.GetFolder(strDirectory)
    Set colSubfolders = MainDir.Subfolders
    Me.lst_Directory.RowSource = ""
    For Each objSubfolder In colSubfolders
        Me.lst_Directory.RowSource = Me.lst_Directory.RowSource & objSubfolder.Name & ","
    Next

Is there a way to let the code know that only certain folders should be allowed to appear by the folder name?
Thank you for looking!
Snapper316
CODE

For Each objSubfolder In colSubfolders
   If objSubFolder.name Like "*blah*" Then
        Me.lst_Directory.RowSource = Me.lst_Directory.RowSource & objSubfolder.Name & ","
Else
    'skip
End If
    Next



maybe?

or if you know the actual subfolder names you want..use a Select Case statement
kdw3
That worked! Thank you!
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.