Label or text box visibility

G

GD

I've set a label on my report to no visibility. Now I need to code it to be
visible based on a Yes/No field (RequestPaidBack) from the source table.
This one doesn't seem to work:

Private Sub Report_OnFormat()
If Me.RequestPaidback = True Then
Me.lblDeniedTitle.Visible = True
Else
Me.lblDeniedTitle.Visible = False
End If

End Sub

Any help? Thanks!!!
 
D

Damon Heron

Change your label to a textbox and in the control source of the textbox,
put:

=IIf([RequestPaidBack],"YourLabeltext"," ")

Damon
 
L

Larry Linson

Access is very "helpful"... in Reports, it does not carry along Fields from
the Source that are not displayed on the report, so your reference to a
Field in the RecordSource is not "seeing" the Yes/No field. If you put it in
an always-invisible text box on the Report, you can refer to either that
Field in the RecordSource or to the TextBox and the code will "see" it, and
your code should then work as you expected.

(Just for the record: All Fields from the Record Source are available in
Forms, so your code would work fine in a Form.)

Larry Linson
Microsoft Office Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top