Is it possible to display an image on the form in a Image Control box from a
hyperlink to the image in a folder? Does anyone have a suggestion/example of
how I could do this?
If the field is an actual Hyperlink field, clicking on it will open
the picture in whatever program you have set up for that type of
picture, i.e. MSPaint, Microsoft Photo Editor, Windows Picture and Fax
Viewer, etc.
If you wish to show the picture in a control on your form then you
don't want a hyperlink field.
Place all of your pictures in the same folder on your hard drive if
you can. If not, it just requires a bit of different coding.
Let's assume all are in the same folder.
Add a Text datatype field to your table.
Name it "MyPicture".
Enter the name of the picture for each record in it, i.e.
UncleJohn.jpg, AuntMary.jpg, etc.
Add an Image control to your form to show the pictures.
When adding the Image control, the wizard will need a picture, so
navigate to any picture stored on your computer.
Save the control.
Then, re-open the Form in Design View and delete the Picture name from
the Image Control's Picture property.
Access will question it. Click Yes.
Then code the Form's Current event:
If IsNull(Me.[MyPicture]) then
Me.ImageControlName.Visible = False
Else
Me.ImageControlName.Picture = "C:\PathToPicture\" & [MyPicture]
Me.ImageControlName.Visible = True
End If
If you do NOT have all of the pictures in the same folder, then add
another field to your table, Text datatype. Name this field
"PicturePath".
Enter, for each record, the path to the folder that records picture is
in, i.e. "C:\MyPictures\FamilyFolder" (without the quotes).
Then code the form's Current event:
If IsNull(Me.[MyPicture]) then
Me.ImageControlName.Visible = False
Else
Me.ImageControlName.Picture = [PicturePath] & "\" & [MyPicture]
Me.ImageControlName.Visible = True
End If
The picture will change as you navigate from one record to the next.