Making fields/labels visible base on value

  • Thread starter Thread starter Eric Blitzer
  • Start date Start date
E

Eric Blitzer

The code below works inconsistently. Fields that should be
visible are not. Do I have this code right and/or is there
a better way using code

Eric

Private Sub Detail_Format(Cancel As Integer, FormatCount As
Integer)

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

If Me.FamilyWorks1 = "yes" Then
Me.FamilyWorks1.Visible = True
Me.FWLABEL.Visible = True
Else
Me.FamilyWorks1.Visible = False
Me.FWLABEL.Visible = False


If Me.WorkPlus = "yes" Then
Me.WorkPlus.Visible = True
Me.Label67.Visible = True
Else
Me.WorkPlus.Visible = False
Me.Label67.Visible = False

If Me.WorkFirst = "yes" Then
Me.WorkFirst.Visible = True
Me.Label66.Visible = True
Else
Me.WorkFirst.Visible = False
Me.Label66.Visible = False

End If
End If
End If

End Sub
 
I assume this is something like hiding labels if the
correponding values are null.
The way I usually do it is by changing the labels to
textboxes and enter an IIF statement like;

=IIF([YourValue] is null, "", "YourLabel")

You would put this in each of the applicable label
textboxes.
This would hide the label when the correcponding data is
null, allowing for canshrink if so desired.
Hope this helps.
Fons
 
Back
Top