Jeff Lance
New member
- Local time
- Today, 00:24
- Joined
- Jun 25, 2021
- Messages
- 2
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?
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
How do I paste that file location and file information back into the text box to be 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