I am having problems on how I can browse for a file and return the path of the file selected by the user.
Example a user will be in Access on a Form, click the Browse for File Command button, locate a file on the C: drive in a folder called test2 and the file name is test.csv.
I would want it to return back to the form in a text box C:\test2\test.csv
Here is the code that I have started but not working:
Private Sub GetFilePath_Click()
Dim sMyPath As String
Dim txtPathName As String
sMyPath = Application.GetOpenFilename _
(filefilter:="Comma Separated Value (*.csv),*.csv|Access Files (*.txt)|*.txt", _
Title:="Select Your File", MultiSelect:=False)
If sMyPath = False Then Exit Sub
txtPathName = sMyPath
End Sub
txtPathName is a text box on the Form….
Any help would be great…
Thanks,
Darkhat
Example a user will be in Access on a Form, click the Browse for File Command button, locate a file on the C: drive in a folder called test2 and the file name is test.csv.
I would want it to return back to the form in a text box C:\test2\test.csv
Here is the code that I have started but not working:
Private Sub GetFilePath_Click()
Dim sMyPath As String
Dim txtPathName As String
sMyPath = Application.GetOpenFilename _
(filefilter:="Comma Separated Value (*.csv),*.csv|Access Files (*.txt)|*.txt", _
Title:="Select Your File", MultiSelect:=False)
If sMyPath = False Then Exit Sub
txtPathName = sMyPath
End Sub
txtPathName is a text box on the Form….
Any help would be great…
Thanks,
Darkhat