This sub opens a file picker, and will return the full UNC path when searching a network share, otherwise it'll return the mapped drive path. It then saves the path for the chosen file to a clickable hyperlink text box on a MS Access continuous subform. It's called from a command button next to the hypFilePath textbox on the subform.
Short and sweet, and works like a charm!
Private Sub cmdPickFile_Click()
'Author: Dave Rowland
'Date added: 12/2/2016
Const msoFileDialogFilePicker As Long = 3
Dim objDialog As Object, strPath As String, strFileName As String
Set objDialog = Application.FileDialog(msoFileDialogFilePicker)
With objDialog
.Title = "Please select a file for this account"
.AllowMultiSelect = False
.Show
If .SelectedItems.Count = 0 Then
MsgBox "No file selected."
Else
strPath = .InitialFileName
strFileName = Dir(.SelectedItems(1))
Me.hypFilePath.Value = strFileName & "#" & strPath & strFileName
End If
End With
End Sub