<

Images on continuous forms

Published on
24,442 Points
9,842 Views
6 Endorsements
Last Modified:
Approved
Very often you need to display images on continuous forms. It could be photos of employees or goods, or other images. You can use attached OLE objects, but they are very whimsical.

You can try the sample in this article:
http://access.bukrek.net/tutorial/continuous-forms
but it is very dependent on your system settings and will not work consistently.

Access 2007 and 2010 give us a modified Image control, which is able to display external images from file paths saved in our records. Advantages of this method are obvious: DB will not grow with each new image, images could be edited and replaced independently.

Let us assume we have a table with a text field containing the full path to an image: tblImagesCreate a continuous form with this field: frmImagesAdd an Image Control to the detail part of your form: image controlWhen asked about the file name, press Cancel.
Open the Image Control's properties:
Image control propertiesYou should set the Control Source to the field with path to images:
Control SourceResult you can see immediately:
form
Now we can make some improvement.
It is a good idea not to store the full path to the image, only the relative path. Using the relative path we do not need to change every record when moving the DB to a new folder or network path. We can add field to our form with path to images (of course it could be field in a table with DB parameters).
If field's name is "path", we can modify control source of our Image Control:
relativeI have added "\" between path to image folder and image name, but you will need to do it only if path is not finished with slash. You can add analysis of path as future improvement.
Included is archive with sample DB and sample images. Unpack all files to one folder and open DB. As you can see there are images in different formats (tiff, jpeg, png) and you can see all images without problems.
ImagesTest.zip
6
Author:als315
Ask questions about what you read
If you have a question about something within an article, you can receive help directly from the article author. Experts Exchange article authors are available to answer questions and further the discussion.
Get 7 days free