Download and expand the Zip file of Bill Wilson's BrowseForFileClass class
module from:
http://community.netscape.com/n/pfx...yMessages&tsn=1&tid=22415&webtag=ws-msdevapps
and add the module to your database. On your from add a text box named
txtPath, and a 'Browse' button with the following code in its Click event
procedure:
On Error GoTo Err_Handler
Dim OpenDlg As New BrowseForFileClass
Dim strPath As String
Dim strAdditionalTypes As String
Dim strFileList As String
strFileList = "*.bmp; *.jpg"
strAdditionalTypes = "Image Files (" & strFileList & ") |" & strFileList
OpenDlg.DialogTitle = "Select File"
OpenDlg.AdditionalTypes = strAdditionalTypes
strPath = OpenDlg.GetFileSpec
Set OpenDlg = Nothing
Me.txtPath = strPath
Exit_here:
Exit Sub
Err_Handler:
MsgBox Err.Description, vbExclamation, "Error"
Resume Exit_here
In the above example I've set the AdditionalTypes property of the class to
image files (.bmp and .jpg) to show how you can add particular file types to
the list of types included by default in the dialogue. These will appear
first in the list when the dialogue opens. Alternatively you could
permanently amend the string assigned to the strFilter variable in the
module's Class_Initialize procedure to include other file types in the list
whenever an instance of the class is established.
In the Click event procedure of the txtPath control put:
On Error GoTo Err_Handler
FollowHyperlink Me.txtPath
Exit_here:
Exit Sub
Err_Handler:
MsgBox Err.Description, vbExclamation, "Error"
Resume Exit_here
to open the selected file when the text box is clicked
Ken Sheridan
Stafford, England