Photo in report error - problem (1 Viewer)

Crash_Pie

Registered User.
Local time
Today, 15:12
Joined
Feb 15, 2007
Messages
36
Hi

I have made a report based on a query that looks at student results. I'm trying to display a photo of the individual student in the Student Header that corresponds to the records being displayed.

I have tried two different approaches with code in two different locations and receive different errors:

Code:
Me![imgRptWindow].Properties("Picture") = Me![txtRptPhotoPath]

The error I get with this one is "Runtime error '2455'. You entered an expression that has an invalid reference to the property Picture." I've seen this code several times in this forum so thought it would work?

My other approach was the one that works for me in my Forms:

Code:
Me![imgRptWindow].Picture = Me![txtRptPhotoPath]

This one rewards me with an error the "Object doesn't support this property or method". I suspect it is refering to the word "Picture" as is doesn't appear in the drop down list when I hit the dot (.) after [imgRptWindow].

Has anyone seen this error before? It has me stumped - I can make it work on a form but not in a report, I thought it would be the same, or similar.

Any help appreciated.
 

Crash_Pie

Registered User.
Local time
Today, 15:12
Joined
Feb 15, 2007
Messages
36
I forgot to mention that I have tried the code in both the header area and the details area and it made no difference.
 

manticore01

New member
Local time
Today, 04:12
Joined
Aug 1, 2007
Messages
4
I just finished creating photos in reports and this is how i done it.

Basically i had a field in a table that contains the path to the picture eg C:\Pictures\Student1.jpg. I named this field "picturepath"

In your report have this field hidden so it cannot be seen (Change Visibility)

Then create an image. A dialog box will ask you to choose a picture, you can choose ANY at this stage. Set the name of this image to something like "studentimage".

After that delete the link in the picture properties "picture" setting. (You can also change the way it displays it to like zoom or clip or whatever).

I then created a macro that had a SetValue event. I told it to set the value of the picture property of the picture that was named "studentimage" in the report. I then told it to set it to the value of the picturepath.

To get this to run, when on the report section go to the properties of the detail section and using the "OnFormat" event tell it to run your macro.

Hope this helps

Chris
 

Crash_Pie

Registered User.
Local time
Today, 15:12
Joined
Feb 15, 2007
Messages
36
Hi Chris

Thanks for the reply. I got to thinking after reading your post and solved the problem. I still had the image frame set to embedded not linked. It was frustratingly obvious, so now I have the photos working using the second VBA example above.

Thanks again.

Crash
 

Users who are viewing this thread

Top Bottom