Suppress a label

R

Ralph

I want to suppress the printing of a label if the
corresponding field is empty "". The detail is set to can
shrink.

For example:

In a course listing, if a course has prerequisites, the
prerequisite label will print. However, if there are no
prerequisites, no label will print and neither should the
field and the detail will shrink.
 
M

Marshall Barton

Ralph said:
I want to suppress the printing of a label if the
corresponding field is empty "". The detail is set to can
shrink.

For example:

In a course listing, if a course has prerequisites, the
prerequisite label will print. However, if there are no
prerequisites, no label will print and neither should the
field and the detail will shrink.


I prefer to use a line of code in the detail section's
Format event:

Me.label.Visible = Not IsNull(Me.textbox)

If the label is attached to the text box, you can make the
text box invisible and its label will become invisible too:

Me.textbox.Visible = Not IsNull(Me.textbox)

If you really mean that the field contains a zero length
string instead of Null. then you can use this kind of
expression to chack for either case:

Me.textbox.Visible = (Nz(Me.textbox, "") <> "")
 
G

Guest

-----Original Message-----



I prefer to use a line of code in the detail section's
Format event:

Me.label.Visible = Not IsNull(Me.textbox)

If the label is attached to the text box, you can make the
text box invisible and its label will become invisible too:

Me.textbox.Visible = Not IsNull(Me.textbox)

If you really mean that the field contains a zero length
string instead of Null. then you can use this kind of
expression to chack for either case:

Me.textbox.Visible = (Nz(Me.textbox, "") <> "")

Worked great! Thank you

- ralph
 
Top