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.
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: Create a continuous form with this field: Add an Image Control to the detail part of your form: When asked about the file name, press Cancel.
Open the Image Control's properties:
You should set the Control Source to the field with path to images:
Result you can see immediately:
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:
I 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
You can't use http://.... path, only some local (d:\....) or network(\\server1\sharedfolder\....) paths. You always should download files from website before you can show it.
Have a question about something in this article?
You can receive help directly from the article author.
Sign up for a free trial to get started.
Comments (3)
Commented:
Commented:
Author
Commented: