Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image in Report Linked by Form 1

Status
Not open for further replies.

SwingXH

Technical User
Jun 15, 2004
97
US
I have some images in a report which are linked by text input in a form. I have code like this

[Reports]![ReportName]![ImagePathName].Picture = ImageName

ImageName includes the path and name and it is a user input.

The problem is that i have to open the report in design view first then the link can be transfered, otherwise there's an error saying either the name of the report is misspelled or the report is not open.
How can I avoid this error? I have several different reports and which one to open depends on the input data. I don't want the user to open them manually.

Thanks a lot!
SwingXH
 
I think your problem is timing. When the report loads it controls before it reads your instructions from the form. Can you do it the opposite way. Have the control source of the images reference back to the form that is used to open the report?



ProDev, MS Access Applications
Visit me at ==> Contact me at ==>lonniejohnson@prodev.us

May God bless you beyond your imagination!!!
 
Thank you, but I don't fully understand the reference back method. Could you please give me a simple example on it?

Thanks,
swingXH
 
Sure, what is the name of the form and the contorl on the form that has the image's path and name?

ProDev, MS Access Applications
Visit me at ==> Contact me at ==>lonniejohnson@prodev.us

May God bless you beyond your imagination!!!
 
Path=txtPath.Value
FileName =txtFileName.Value
InputForm is the form name and InputReport is the report name.
Thanks,
swingXH
 
Use an image control on your report and put this in the Report's On Open event...

Code:
Private Sub Report_Open(Cancel As Integer)
 
    MyImage.Picture = Forms![InputForm]![txtPath] & Forms![InputForm]![txtFileName]

End Sub

Let me know if this helps.

ProDev, MS Access Applications
Visit me at ==> Contact me at ==>lonniejohnson@prodev.us

May God bless you beyond your imagination!!!
 
I have to say thank you very much. It worked great!

SwingXH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top