I'm using access form in which I have a button to explore files and get the path. My form is created to insert data into TABLA1.
TABLA1 contains a field named sPath in which I want to SAVE the files paths.
I reviewd ms access browse for file and get file name and path several times but I don't find solution.
What I'm doing wrong? Why filePath is not saved into sPath field.
I'm using Access 2007. Thank you very much on advance and sorry for I'm limited working with VB.
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
sFile = Filename(f.SelectedItems(i), sPath)
MsgBox sPath & "---" & sFile
Next
End If
End Sub
Public Function Filename(ByVal strPath As String, sPath) As String
sPath = Left(strPath, InStrRev(strPath, "\"))
Filename = Mid(strPath, InStrRev(strPath, "\") + 1)
End Function