Hide one field if another is loaded??

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In a report, how can I code a field to hide on the report if a second field
is loaded? in other words, I want the field name 'street' to hide, if the
'RD' field has been filled in. thanks
 
Debba said:
In a report, how can I code a textbox to hide on the report if a second textbox
is populated? in other words, I want the field name 'street' to hide, if the
'RD' field has been filled in. thanks
 
Assuming this is to happen in the report's detail section, you could use
something like this in the detail section's Print event:

If Not IsNull(Me.RD) Then
Me.txtStreet.Visible = False
Else
Me.txtStreet.Visible = True
End If

Me.RD is the RD field in the record source. txtStreet is the text box
containing the Street. If you hide the text box, the attached label (the
one that shows up automatically when you add a text box) will also be
hidden.

If the default value of RD is a zero-length string you may need to use If
Me.RD = "" Then ... etc., but the first example will probably work.

Note that the Print event occurs before the report is printed, so you will
be able to see the formatting without actually printing the report.
 
Thanks Bruce, worked a treat!

BruceM said:
Assuming this is to happen in the report's detail section, you could use
something like this in the detail section's Print event:

If Not IsNull(Me.RD) Then
Me.txtStreet.Visible = False
Else
Me.txtStreet.Visible = True
End If

Me.RD is the RD field in the record source. txtStreet is the text box
containing the Street. If you hide the text box, the attached label (the
one that shows up automatically when you add a text box) will also be
hidden.

If the default value of RD is a zero-length string you may need to use If
Me.RD = "" Then ... etc., but the first example will probably work.

Note that the Print event occurs before the report is printed, so you will
be able to see the formatting without actually printing the report.
 
Back
Top