By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,902 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

Showing or hiding images in a report

P: 2
I am trying to figure out how to show a different image on a report based on the results of a formula. Conditional formatting allows me to change text, but I want to be able to swap out an image based on a formulated result from the report.

I tried doing an event on the report header just to turn of the visibility of a test image, and can't even get that to work...lol

Any direction or ideas here?

fyi...the purpose is that if someone does well, they get a green symbol, ok=yellow, bad=red...that sort of thing.
Sep 10 '08 #1
Share this Question
Share on Google+
3 Replies


ADezii
Expert 5K+
P: 8,619
Assuming the Image Control is named imgColor, the Text Box on the Report is named txtFormula, and the Graphics Files are stored in C:\Graphics, the following code placed in the Format() Event of the Report will load different Graphic Images into the imgColor Control for specific Formulas. Any Formula not meeting the criteria will show a Green Image. This should point you in the right direction.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  2. Select Case Me![txtFormula]
  3.   Case "Formula_1"
  4.     Me![imgColor].Picture = "C:\Graphics\Red.jpg"
  5.   Case "Formula_2"
  6.     Me![imgColor].Picture = "C:\Graphics\Yellow.jpg"
  7.   Case "Formula_3"
  8.     Me![imgColor].Picture = "C:\Graphics\Purple.jpg"
  9.   Case Else         'All other Formulas
  10.     Me![imgColor].Picture = "C:\Graphics\Green.bmp"
  11. End Select
  12. End Sub
Sep 10 '08 #2

P: 2
Thanks...it still isn't working though. Is it because I am using a standard image as opposed to some sort of control (bound or unbound)?

I even just put the code:

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)

Me![imgColor].Picture = "C:\Users\alanb.NETWORK\Pictures\red.JPG"

End Sub

And that didn't even swap out the pic. I am missing something really obvious I am sure.
Sep 11 '08 #3

ADezii
Expert 5K+
P: 8,619
Thanks...it still isn't working though. Is it because I am using a standard image as opposed to some sort of control (bound or unbound)?

I even just put the code:

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)

Me![imgColor].Picture = "C:\Users\alanb.NETWORK\Pictures\red.JPG"

End Sub

And that didn't even swap out the pic. I am missing something really obvious I am sure.
Place the code in the Format() Event of the Report's Detail Section to load Images for each Record.
Sep 11 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.