Adding different images to a report based on Iff statement

SammiH

Registered User.
Local time
Today, 19:19
Joined
Feb 10, 2009
Messages
16
Not sure if this is possible, but I have a text box that currently returns different text based on an Iff query. I've set it to Wingdings, so I get a smiley or sad face depending on whether a value meets a target or not (True/False). Here it is:
=IIf([Text61]=" "," ",IIf([Text61]="True","J",IIf([Text61]="False","L")))

Our customers now say they would prefer a traffic light system instead. I have some pictures stored as .jpg files and have managed to get these into a separate report. How do I get the existing text box to select the pictures and display them rather than text? If I just insert the path to the pictures, instead of the "J" and "L", I get blank boxes on the report. What do I need to do /check to make sure they appear?
Thanks - I am completely self-taught and will need very basic guidance:o
 
Stack the pictures on top of each other where you want them to appear and then use something like this in the Report Detail ....

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If Me.txtEvalControl = CorrectValue Then
        Me.OLERedLight.Visible = True
        Me.OLEGreenLight.Visible = False
    Else
        Me.OLERedLight.Visible = False
        Me.OLEGreenLight.Visible = True
    End If
End Sub

HTH,
-dK
 
Thank you very much - that worked, but I have a third variable where I don't want either picture to appear, how can I phrase this?
In other words, the txtEvalControl can be "On Target" (Image1), "Not On Target" (Image2) or "na" (no image).
 
Thank you- I've now solved this using the ElseIf code:

If Me.Text61 = "On Target" Then
Me.Image3.Visible = True
Me.Image2.Visible = False

ElseIf Me.Text61 = "Not On Target" Then
Me.Image3.Visible = False
Me.Image2.Visible = True

Else
Me.Image2.Visible = False
Me.Image3.Visible = False

End If
 
Awesome! Glad you got it to go.

Good luck!

-dK
 

Users who are viewing this thread

Back
Top Bottom