How to hide a text field label when the field is null? Access2003

P

Pearl

In MS Access 2003 report, how to hide the label attached to a text field when
the text field is blank? Example: Field Name = [MiddleName]; the label for
[MiddleName] is [MidNameLbl]. If no middle name, I do not want the label to
appear. Thanks
 
D

Duane Hookom

The no-code method is to change the label to a text box and set its properties:
Control Source: ="Mid. Name: " + [MiddleName]
Can Grow: No
Can Shrink: Yes
If MiddleName is null, the text box will disappear.
 
D

Dale Fye

The code version would be to add some code to the Format event of whatever
section (probably the details) the control is located in. Something like:

Private Sub Details_Format

me.MidNameLbl.visible = LEN([MiddleName] & "") = 0

End Sub

The reason I used the expression on the right side of the equal sign is that
the field could also be a zero length string.

HTH
Dale
 

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