I am trying to create an Access form which allows the user to select a JPG file which then stores the image in a SQL Server table. I have the SQL Server table storing the data (if I insert it using a query) and displaying the save image, but I cannot figure out how to allow the user to select a file and read the data into the field. Here is the code I have to get the file NAME, but how do I get the file CONTENTS into the imgToolImage field?
Private Sub imgToolImage_Click()
Dim fDialog As Office.FileDialog
Dim strCompany As String
Dim strFormName As String
Dim strInitialFolder As String
Dim strPathName As String
Dim varFile As Variant
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.Title = "Please select the file you wish to attach."
If .Show = True Then
For Each varFile In .SelectedItems
Me.imgToolImage.PictureData = varFile
Set fDialog = Nothing