Show a picture on a form specific to each record - JCW

J

JohnW

I want to add a picture to a form that will show a specific picture for each
record. I have a picture field set to OLE Object. Ideally I would like for
the user's to be able to do this without going back to design view but I'll
accept that if I have to.

Any ideas? Thanks.
 
F

fredg

I want to add a picture to a form that will show a specific picture for each
record. I have a picture field set to OLE Object. Ideally I would like for
the user's to be able to do this without going back to design view but I'll
accept that if I have to.

Any ideas? Thanks.

Do not use an OLE control.

Store all of the pictures in one separate folder, i.e.
MyPictureFolder.

Add a new field to your table,
[Photo] Text datatype.
For each record, enter the name of the picture (including it's
extension) you wish that record to display, i.e. "Lilacs.jpg" (without
the quotes).

Add an Image control to the form to show the pictures.
When adding the Image control you'll have to enter a picture name.
Enter any valid picture name. Save the control.
Then, delete the Picture name property. Access will question it. Click
Yes. When done the Picture property should read (none).

Add a label over the center of the Image control.
Set it's Caption property to:
"No Picture Available"
Set it's visible property to No.

Then code the Form's Current event:
If IsNull(Me.[Photo]) then
Me.ImageControlName.Visible = False
Me.labelName.Visible = True
Else
Me.ImageControlName.Picture = "C:\PathToFolder\MyPictureFolder\" &
[Photo]
Me.ImageControlName.Visible = True
Me.labelName.Visible = False

End If

If the record has no associated picture the "No Picture Available"
label will become visible and the Image not visible.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top