Solved Store File picker return back into the table (1 Viewer)

Jeff Lance

New member
Local time
Yesterday, 19:11
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
 

Attachments

  • Test.accdb
    2 MB · Views: 133

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:11
Joined
Oct 29, 2018
Messages
16,572
Hi. Welcome to AWF!

After the line MsgBox (P), try adding the following:
Code:
Me.Line3 = P
 

Users who are viewing this thread

Top Bottom