gaining Access to image control in data report

Hello Sir,
 I want to display image in data report at run time where the name of image will be given by user.I had used the string like..
avgRating.Sections("section2").Controls.Item("image1").Picture = "d:\tpf\av.bmp"
but its not working.It is hsowing the error.
Please tell me how to display the image in data report.

Regards,
laveshvermaAsked:
Who is Participating?
 
laveshvermaAuthor Commented:
Hello All,
I got the solution as by putting the work " set " before the statement as
set avgRating.Sections("section2").Controls.Item("image1").Picture = LoadPicture("d:\tpf\av.bmp")
Thank you all for your help,

Regards,
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
What is "the error" that is showing?
0
 
hnasrCommented:
Try to use the control's name directly. If we have Imag1 control, then
In format event,
Image1.Picture = "d:\tpf\av.bmp"
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
laveshvermaAuthor Commented:
To Mr. LSMConsulting,
Sir I had used the following statement-
avgRating.Sections("section2").Controls.Item("image1").Picture = LoadPicture("d:\tpf\av.bmp")
But it is showing the error as:
"Object doesnt support this property or method"
How this error can be removed?
0
 
laveshvermaAuthor Commented:
To hnasr,
sir where this code  should be written?, I am accessing the data report thru vb form . If i write the code in vb form , it show the error cuase the control " image1" is a contorl of report, not of form.
So how to correct this error?
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You don't use LoadPicture for this, just set the .Picture property to the full path to your image, as hnasr has shown you. You would obviously need to refer to your control correctly, as you seem to have done here:

avgRating.Sections("section2").Controls.Item("image1").Picture = "d:\tpf\av.bmp"

0
 
laveshvermaAuthor Commented:
To LSMConsulting,
Sir I had tried the syntax given by you also, But it is also showing the saem error as " Oject doesnt support this property or method"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.