I have VBA code that when you click a text box it opens a file picker to choose a file for a reference for a picture on the form.
How do I paste that file location and file information back into the text box to be saved in the table?
P returns the info that needs to be saved in the Text Box and saved in the Table.
Private Sub Text26_Click()
Dim f As Object
Dim strFile As String
Dim strFolder As String
Dim varItem As Variant
Dim P As String
Set f = Application.FileDialog(3)
f.AllowMultiSelect = False
If f.Show Then
For Each varItem In f.SelectedItems
strFile = Dir(varItem)
strFolder = Left(varItem, Len(varItem) - Len(strFile))
P = strFolder & strFile
Next
End If
' CurrentDb.Execute "Insert Into tblinfo (Line3) " & P
Set f = Nothing
'MsgBox (strFile)
'MsgBox (strFolder)
MsgBox (P)
End Sub