Well, it said you aren't allowed to alter it. However, i don't see how you could learn vba and not alter it.
The other thing is... for some reason, probably cause Dev Ashish is an access genius, the on from the site works a bit faster then mine when looking up directories with a lot of files, like 100 or more.
I use mine a lot though, we use it to look up files associated with clients, so after we create a folder for a client the path for the client can be looked up as the default path, it then displays all the files for that client.
Anyways,
This is how it works:
on a form i have an unbound listbox(lstFolderContents) and an undbound textbox(txtFolderLocation). I have three buttons: btnDocuments, btnImages, btnAllFiles; those buttons set what files will be displayed in the list box. I also have a transparent button to use as a hyperlink: btnLink.
For your specific solution.... You can either set the default of the txtbox through code: like v:\web\tools\files, or make it bound as a dlookup or something to a table or maybe something else.
If anyone has any suggestions on how to improve this i would be greatful. Also, I used a module written by terry craft to browse folders, but it doesn't work in the form like Dev Ashish's does. I'll have to look at his. Currently the listbox also doesn't show the subfolders. I was looking in how to do that, i just wrote this module on last week, so i'm sure there should be some improvement, but so far it's been great.
Then you can put this in the forms module:
Function ClearList()
lstFolderContents.RowSource = ""
lstFolderContents.RowSourceType = "Value List"
End Function
Function fncGetFiles(intSelect As Integer)
Dim MyFolder$, myfile
Dim intFilesize As Double
Dim stFS As String
lstFolderContents.ColumnHeads = True
' list headers
lstFolderContents.RowSource = "File Name; Size; Date Created;"
' some of the folder selections are typed in with a \ others aren't. this makes sure there is a \ at the end of of the string
strName = Me!txtFolderLocation & "\"
If right(strName, 2) = "\\" Then
strName = Me!txtFolderLocation
End If
lstFolderContents.RowSourceType = "value list"
MyFolder = strName
myfile = Dir(MyFolder)
DoCmd.Hourglass True
While myfile <> ""
' this decides whether the file is smaller or larger then a mb for display in the second column
If FileLen(strName & myfile) / 1000 < 1 Then
intFilesize = Round((FileLen(strName & myfile) / 1), 0)
stFS = intFilesize & " bytes"
Else
If FileLen(strName & myfile) / 1000 > 2000 Then
intFilesize = Round((FileLen(strName & myfile) / 1000000), 2)
stFS = intFilesize & " mb"
Else
If FileLen(strName & myfile) / 1000 < 2000 Then
intFilesize = Round((FileLen(strName & myfile) / 1000), 0)
stFS = intFilesize & " kb"
End If
End If
End If
'check to see what button was pushed. all files would be selection one, it doesn't need a filter.
If intSelect = 2 Then
If right(myfile, 4) = ".gif" Or right(myfile, 4) = ".jpg" Or right(myfile, 4) = ".png" Or right(myfile, 4) = ".bmp" _
Or right(myfile, 4) = ".tif" Or right(myfile, 5) = ".jpeg" Then
Else
' if the item is not in the filtered group, the are send down to move on to the next file.
GoTo WendOut:
End If
Else
If intSelect = 3 Then
If right(myfile, 4) = ".xls" Or right(myfile, 4) = ".doc" Or right(myfile, 4) = ".txt" Or right(myfile, 4) = ".rtf" _
Or right(myfile, 4) = ".htm" Or right(myfile, 5) = ".html" Or right(myfile, 4) = ".xml" Then
Else
' if the item is not in the filtered group, the are send down to move on to the next file.
GoTo WendOut:
End If
End If
End If
' once the files have been filtered then come down to these lines to fill the columns
lstFolderContents.RowSource = lstFolderContents.RowSource & _
myfile & ";" & _
stFS & "; " & _
Format(FileDateTime(strName & myfile), "Short Date"

& "; "
WendOut:
myfile = Dir
Wend
DoCmd.Hourglass False
finderror:
Debug.Print lstFolderContents.RowSource
Debug.Print Len(lstFolderContents.RowSource)
End Function
The call this for the buttons
Private Sub btnAllFiles_Click()
ClearList
fncGetFiles 1
End Sub
Private Sub btnImages_Click()
ClearList
fncGetFiles 2
End Sub
Private Sub btnDocuments_Click()
fncGetFiles 3
ClearList
End Sub
' and this for the onclick event of the listbox.
Private Sub lstFolderContents_Click()
strName = Me!txtFolderLocation & "\"
If right(strName, 2) = "\\" Then
strName = Me!txtFolderLocation
End If
strLink = strName & lstFolderContents
Set ctl = Me!btnLink
With ctl
.Visible = False
.HyperlinkAddress = strLink
.Hyperlink.Follow
End With
End Sub
Mark P.
Bleh