Pictures on Forms
A very common request is to display a picture
in a database form. Unfortunately Access tends to bloat the database if you try
and store images within it, also what happens if you want to get the image back
out or edit it. Time for an image box which you control.
Go into design mode for the relevant form. Choose the picture
box object and create a picture box on the form. Link it to any picture you can
find for the time being. Save the form and go into the properties of the image
box. Delete the picture path name. It will ask you if you want to delete the
background picture choose yes. Change the picture type to linked and the size
mode to zoom. Change it's name to imgEmpty. Save the form again.
Now how to fill the box with an image. You have two options
here.
1. Have a button list box combo box on the form and set the
picture from a choice. Create the list box combo box or button and for it's
click event place the following code
| Me.imgEmpty.picture = "c:\path to
picture\" & listboxname.value |
2. Refresh the picture for each record based on a value in a
field. (Personnel Information, Subscription Information, Identity cards). Go
into the forms properties and on the event tab choose the On Current event and
click the build icon. In the code window type the following. In this example our
images are stored in the c:\temp directory and the MemberPicture is the name of
the field that holds the individual picture name.
| Me.imgEmpty.picture = "c:\temp\"
& Me.MemberPicture.value |
This event will kick off when the form opens and whenever
someone moves to a new record.
The picture box supports many different formats, including
bmp,gif,wmf.jpg,cdr and more.
|