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.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
What is "the error" that is showing?
Hamed NasrRetired IT ProfessionalCommented:
Try to use the control's name directly. If we have Imag1 control, then
In format event,
Image1.Picture = "d:\tpf\av.bmp"
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?
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

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?
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"

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,


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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"
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.