Hi All,
I have a report that I wish to have list boxes and their corresponding labels visible based on certain criteria. Is there a way to loop this code?
Thanks!
I have a report that I wish to have list boxes and their corresponding labels visible based on certain criteria. Is there a way to loop this code?
Code:
Private Sub Report_Activate()
' set all labels invisible
Me.lblHead.Visible = False
Me.lblFacial.Visible = False
Me.lblEar.Visible = False
Me.lblNeck.Visible = False
Me.lblEye.Visible = False
Me.lblShoulder.Visible = False
Me.lblChest.Visible = False
Me.lblElbow.Visible = False
Me.lblArm.Visible = False
Me.lblAbdomen.Visible = False
Me.lblBack.Visible = False
Me.lblWrist.Visible = False
Me.lblHand.Visible = False
Me.lblHip.Visible = False
Me.lblThigh.Visible = False
Me.lblKnee.Visible = False
Me.lblAnkle.Visible = False
Me.lblShin.Visible = False
Me.lblFoot.Visible = False
' set all list boxes invisible
Me.lstHead.Visible = False
Me.lstFacial.Visible = False
Me.lstEar.Visible = False
Me.lstNeck.Visible = False
Me.lstEye.Visible = False
Me.lstShoulder.Visible = False
Me.lstChest.Visible = False
Me.lstElbow.Visible = False
Me.lstArm.Visible = False
Me.lstAbdomen.Visible = False
Me.lstBack.Visible = False
Me.lstWrist.Visible = False
Me.lstHand.Visible = False
Me.lstHip.Visible = False
Me.lstThigh.Visible = False
Me.lstKnee.Visible = False
Me.lstAnkle.Visible = False
Me.lstShin.Visible = False
Me.lstFoot.Visible = False
' make labels and list boxes visible per query
If [lstHead].ListCount > 0 Then
Me.lblHead.Visible = True
Me.lstHead.Visible = True
End If
If [lstFacial].ListCount > 0 Then
Me.lblFacial.Visible = True
Me.lstFacial.Visible = True
End If
If [lstEar].ListCount > 0 Then
Me.lblEar.Visible = True
Me.lstEar.Visible = True
End If
If [lstNeck].ListCount > 0 Then
Me.lblNeck.Visible = True
Me.lstNeck.Visible = True
End If
If [lstEye].ListCount > 0 Then
Me.lblEye.Visible = True
Me.lstEye.Visible = True
End If
If [lstShoulder].ListCount > 0 Then
Me.lblShoulder.Visible = True
Me.lstShoulder.Visible = True
End If
If [lstChest].ListCount > 0 Then
Me.lblChest.Visible = True
Me.lstChest.Visible = True
End If
If [lstElbow].ListCount > 0 Then
Me.lblElbow.Visible = True
Me.lstElbow.Visible = True
End If
' and so on ......
Comment