Hello,
I am trying to store image files in my database. I have a maximum of three images that I would like to be seen. This is a product database so some products will have as many as three images, and some may have as few as one. The query which is the control source for my form has three text fields (one for each picture) where the directory path for the images are stored. The text fields are Pic1, Pic2 and Pic3. The three object frames I am trying to link to are called PICTURE1, PICTURE2, and PICTURE3. Here is the code I am trying to use.
For some reason when I try switching between products I get an "invalid use of Null" error message and none of the pictures show up. Can anyone tell me what I am doing wrong?
I am trying to store image files in my database. I have a maximum of three images that I would like to be seen. This is a product database so some products will have as many as three images, and some may have as few as one. The query which is the control source for my form has three text fields (one for each picture) where the directory path for the images are stored. The text fields are Pic1, Pic2 and Pic3. The three object frames I am trying to link to are called PICTURE1, PICTURE2, and PICTURE3. Here is the code I am trying to use.
Code:
Private Sub Form_Current()
'Code to link pictures
Dim strPath1 As String
Dim strPath2 As String
Dim strPath3 As String
On Error GoTo err_Current
strPath1 = Me!Pic1
strPath2 = Me!Pic2
strPath3 = Me!Pic3
ImgCtrl.PICTURE1 = strPath1
ImgCtrl.PICTURE2 = strPath2
ImgCtrl.PICTURE3 = strPath3
exit_Sub:
Exit Sub
err_Current:
MsgBox Err.Description
Resume exit_Sub
End Sub
For some reason when I try switching between products I get an "invalid use of Null" error message and none of the pictures show up. Can anyone tell me what I am doing wrong?