accessing an image control on a report

  • Thread starter Thread starter JB
  • Start date Start date
J

JB

My question is very simple. I am simply wanting to
use VBA to properly reference an image object inside of a report.

Let's say I have a report called rptImgReport.
From my "Open" event of this report I have the following code.

This does not work below.
Private Sub Report_Open(Cancel As Integer)
Report_rptImgReport.Image143.Picture = "C:\MyImage.jpg"
End Sub


I cannot reference the "Picture" property this way. I've spent a couple of
hours on this and even looked through the Object Browser - and I cannot seem
to reference it. I'm not new to VBA and I'm in MS Access 2003. I can get
the Report.Picture property, but the image control on the report - no go.
I'm sure it's something simple and I'm just not seeing it. Thanks!
 
Actually, I figured it out. I got a tip from this forum -
http://www.tek-tips.com/viewthread.cfm?qid=289543 - Although for me it still
didn't work exactly, it gave me a clue as to how to back into the solution.
I simply investigated an image that was on the form where the Picture
property was hardcoded in. Then I threw up some message boxes to see if I
could get to the properties of that image. Once I did that, I was then able
to figure out how to put data in it and viola. This if for MS Access 2003 so
I'm not sure if it is different in 2000. Hope this helps someone. I also
added this to a new thread with the same title. I didn't mean to intrude on
this post that was already going. Charge it to my head and not my heart! I
will place this code inside the OnFormat event, but it did work for OnOpen as
well.

Private Sub Report_Open(Cancel As Integer)
Me.Image0.Properties("Picture").Value = "C:MyImage.JPG"
Me.Image0.Properties("PictureType").Value = 1
Me.Image0.Properties("PictureAlignment").Value = 1
Me.Image0.Properties("SizeMode").Value = 0

End Sub
 
Back
Top