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 deans
by sl-campbell
by deans
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.
by deans
by deans
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending