IIf statement on bound object frame

jetersauce

Registered User.
Local time
Today, 01:49
Joined
Dec 21, 2010
Messages
20
I need to know if you can put a conditional statement on a bound object frame.

If a result has been approved it needs to display the signature of the person that reviewed it. If it has only been validated it needs to display the text "Results Not Final"

I have a working statement on a textbox that does something similar (ResultStatus=2 is validated and ResultStatus=3 is reviewed).

=IIf([ResultStatus]<=2,"Results Not Final","Reviewed By:")

But when I put:
=IIf([ResultStatus]<=2,"Results Not Final",[SignatureImage])

It will not display the signature or text
 
No, you can't display text in place of the bound object like that. But you could either

1. Have an image that says Results Not Final and display it instead. OR

2. Have a text box or label on the report under the bound object control that says those words and then in the ON FORMAT event of the section that the controls are in, you can use
Code:
If Me!ResultStatus <=2 Then
   Me.YourTextBoxOrLabelNameHere.Visible = True
   Me.YourBoundObjectFrameNameHere.Visible = False
Else
   Me.YourTextBoxOrLabelNameHere.Visible = False
   Me.YourBoundObjectFrameNameHere.Visible = True
End If
 
Thanks for the reply :D

Sorry, but I'm not very well versed in VB. I opened the code builder on the section the signature is in, but I am getting an error message:

Run-time error '2465'
Microsoft Access can't find the field 'ResultStatus' referred to in your expression.

This is what I put in the code builder:
Code:
Private Sub GroupFooter0_Format(Cancel As Integer, FormatCount As Integer)
If Me!ResultStatus <= 2 Then
   Me.Text175.Visible = True
   Me.SignatureImage.Visible = False
Else
   Me.Text175.Visible = False
   Me.SignatureImage.Visible = True
End If
End Sub
Did I put the code in the wrong area? The query is pulling the ResultStatus field, it is being used elsewhere in the report.
 
The items all need to be in the same section to be dependent upon each other for this type of thing. How many records would be in the group that would have a result status and would any of them ever be different?
 
Thanks that worked, I put the ResultStatus in that section and made it not visible. Every record would have a result status and they will all be the same per report. Thanks, I was at a loss on how to do this.
 
Sorry, I have another question about this. If the query linked to the report does not return any results the following error occurs.

Run-time error 2427
You entered an expression that has no value

At this point several other errors occur and you have to close the database and reopen it to continue to work. The debug points to this line:
Code:
Private Sub GroupFooter0_Format(Cancel As Integer, FormatCount As Integer)
->If Me!ResultStatus <= 2 Then
   Me.Text175.Visible = True
   Me.SignatureImage.Visible = False
Else
   Me.Text175.Visible = False
   Me.SignatureImage.Visible = True
End If
End Sub
Is there another statement I could put in that would keep this error from occurring if the ResultStatus field has no data?
 
You could use NZ:

If Nz(Me!ResultStatus, 0) <= 2 Then
 

Users who are viewing this thread

Back
Top Bottom