Storing the selected item from a file lookup to a text box field
This solution below worked like it was supposed to.
However, I have been trying to modify the output to store the selected strFilePath into text box data.
I have a form that the user inputs a lot of data which get stored in to text boxes. The values in the text boxes are used in a Query Update. I would like to get the strFilePath into a form text box that can be accessed by my query.
What do I need to modify in the following? I tried storing the strFilePath to a TempVar.
Private Sub cmdAttachFile_Click()
Dim rsFile As DAO.Recordset
Dim strFilePath As String, strFilename As String
strFilePath = fSelectFile()
If strFilePath & "" <> "" Then
strFilename = Mid(strFilePath, InStrRev(strFilePath, "\") + 1)
!RecordID = Me.txtMainID
!FilePath = strFilePath
!FileName = strFilename
Dim fd As Object
Set fd = Application.FileDialog(3)
.InitialFileName = CurrentProject.Path & "\"
.AllowMultiSelect = False
.ButtonName = "Select"
.InitialView = 2
.Title = "Select File"
'display file dialog box
If .Show Then
fSelectFile = .SelectedItems(1)