Hello - I figured out how to code a button to browse windows explorer for files on a form in Access 2016. I opted to allow multi select because with shape files I will need to select several files. My button works, I can select multiple files, but only one shows up in the text box (named FileLocation) I created to display the link to the file. How can I display the links to all selected files on my access form?
All of these files are on shared drives. Is there a way to code to make the file name display after selecting it in Windows Explorer to do so that does not include the mapped drive letter but still link to the file? The problem is the shared drive is mapped with different letters on employee's individual computers. I need a file path to display, that whoever clicks on it will be able to open it in the shared drive regardless of what letter is used to map the shared drive.
Here is my code:
Private Sub Browse_File_Button_Click()
Dim f As Object
Dim strfile As String
Dim strfolder As String
Dim varItem As Variant
Set f = Application.FileDialog(3)
f.AllowMultiSelect = True
If f.Show Then
For Each varItem In f.SelectedItems
strfile = Dir(varItem)
strfolder = Left(varItem, Len(varItem) - Len(strfile))
MsgBox "Folder" & strfolder & vbCrLf & _
"File: " & strfile
FileLocation = strfolder & strfile
Next
End If
Set f = Nothing
End Sub
Thank you so much in advance for any assistance!