Acceso a ms busca el archivo y obtén el nombre y la ruta del archivo
Estoy usando ms access y quiero agregar un botón para buscar un archivo, obtener el nombre del archivo y su ruta. Luego quiero almacenar la ruta del archivo y el nombre del archivo en 2 variables separadas. El código que tengo hasta ahora está abajo y en este momento puedo buscar un archivo y obtener el nombre del archivo solamente. ¿Puede alguien ayudarme a agregar a mi código para obtener la ruta del archivo y almacenar tanto el nombre del archivo como la ruta del archivo en variables separadas?
Private Sub Command7_Click()
Dim f As Object
Set f = Application.FileDialog(3)
f.AllowMultiSelect = True
If f.Show Then
For i = 1 To f.SelectedItems.Count
MsgBox Filename(f.SelectedItems(i))
Next
End If
End Sub
Public Function Filename(ByVal strPath As String) As String
If Right$(strPath, 1) <> "\" And Len(strPath) > 0 Then
Filename = Filename(Left$(strPath, Len(strPath) - 1)) + Right$(strPath, 1)
End If
End Function