Discussion Locked

Printing images in a report using links

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I am required to print an Access 97 report that requires images. Is there a way of printing jpeg images in a report using links rather than embedding? The database is quite large (100mb) and I don't want to have to insert the images directly into the database. The images are located on a shared network drive and I want the report to link to them when I print.

7 replies

by sl-campbell

Use an unbound OLE container object and link the objects in code. After placing it on the report, click 'OK' and then cancel the window that comes up asking for an object. In the code window on an event such as form load or when the data is changed,use code to link an object, (OLE1.CreateLink). You could store the picture names and paths in a database, and use these to identify what needs to be linked and where it is located.

I have used this for a report where in the table that has the data for the report are either 2 fields for file name and file path, or, an "key" field that identifies which record in another table has the file name and path of the picture for the current record.

There are of course other ways of doing this like using a plain old picture control.

by sl-campbell

I spent time to answer your question and the answer I gave works and doesn't store the pictures in a database as you wanted. Therefore I cannot understand why it was rejected. If you needed more info or had problems implenting it you could have added a comment or sent an e-mail.

by bob sellman

I had to solve this problem some time ago. I'm going to assume that the image will change with each record (such as an employee database with a picture of each employee).

First, you must include a column in your data table that contains the filepath and name, or (for flexibility) have one column with the file name and a second table that contains the standard path and directory to the images (allowing easy changing of the path for all images).

Build a form with a text control that contains the path/file name. Let's call it txtFile. Make a second with the path if needed. They can be invisible if you want.

Make an image control (let's call it imgA). Put any picture in it to start. For the OnCurrent property of the form AND for the on update property of txtFile put the following code:

me.imgA.Picture = me.txtFile

When your form opens or you go to a new record it will load the picture control with the contents of the graphic file referenced by the contents of txtFile.

Good luck.

This discussion is closed to new replies.