How can I attach and view pictures in the database, like catalog

  • Thread starter Thread starter spcelangel
  • Start date Start date
S

spcelangel

I am trying to create a database for cattle, and in doing so, would like to
have a picture of each one on the form. How do I do this?
 
I am trying to create a database for cattle, and in doing so, would like to
have a picture of each one on the form. How do I do this?

Store the pictures in a separate folder.
Add a text datatype field to your table. Let's name it "Photo".
Using your form, enter the name of each picture in the Photo field.
Include the picture extension, i.e. Angus.jpg

Add an Image control to your form.
You'll probably have to enter a picture name. Any picture name is
fine.
Save the control.
Then, delete the Picture name. Access will question it. Click Yes.

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.
Name this label "lblNoPicture"

Code the Form's Current event:

If IsNull(Me.[Photo]) then
Me.ImageControlName.Visible = False
Me.lblNoPicture.Visible = True
Else
Me.ImageControlName.Picture = "C:\PathToPicture\" & [Photo]
Me.ImageControlName.Visible = True
Me.lblNoPicture.Visible = False

End If

As you navigate through the records, the appropriate picture will
display. If no picture is available, the label will display.
 
Thanks Fredg, I will check it out this next week and see if I can get it to
work.

Thanks again.

fredg said:
I am trying to create a database for cattle, and in doing so, would like to
have a picture of each one on the form. How do I do this?

Store the pictures in a separate folder.
Add a text datatype field to your table. Let's name it "Photo".
Using your form, enter the name of each picture in the Photo field.
Include the picture extension, i.e. Angus.jpg

Add an Image control to your form.
You'll probably have to enter a picture name. Any picture name is
fine.
Save the control.
Then, delete the Picture name. Access will question it. Click Yes.

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.
Name this label "lblNoPicture"

Code the Form's Current event:

If IsNull(Me.[Photo]) then
Me.ImageControlName.Visible = False
Me.lblNoPicture.Visible = True
Else
Me.ImageControlName.Picture = "C:\PathToPicture\" & [Photo]
Me.ImageControlName.Visible = True
Me.lblNoPicture.Visible = False

End If

As you navigate through the records, the appropriate picture will
display. If no picture is available, the label will display.
 
Back
Top