Try:
Code:
Option Compare Database
Option Explicit
Private Sub cmdFileDialog_Click()
Dim fDialog As Office.FileDialog
Dim varFile As Variant
' Set up the File dialog box.
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
' Allow the user to make one selection in the dialog box.
.AllowMultiSelect = False
' Set the title of the dialog box.
.Title = "Select One File"
' Clear out the current filters, and then add your own.
.Filters.Clear
.Filters.Add "Access Databases", "*.MDB"
.Filters.Add "Access Projects", "*.ADP"
.Filters.Add "All Files", "*.*"
' Show the dialog box. If the .Show method returns True, the
' user picked at least one file. If the .Show method returns
' False, the user clicked Cancel.
If .Show = True Then
' Loop through each file that is selected and then add it to the text box.
For Each varFile In .SelectedItems
Me.textboxname = varFile
Next
GoHyperlink(varFile)
Else
MsgBox "You clicked Cancel in the file dialog box."
End If
End With
End Sub