Hi all,
Can anyone help with a more elegant solution?
I have multiple checkboxes on a form. Each check box sets the visible property of a corresponding label. This works in the short term but as I add more check boxes (with more combinations) it will become unwieldy to code.
eg. (short version)
Sub lblVisible()
If Me.chkA = False And Me.chkB = False And Me.chkC = False Then
Me.lblA.Visible = False
Me.lblB.Visible = False
Me.lblC.Visible = False
ElseIf Me.chkA = True And Me.chkB = False And Me.chkC = False Then
Me.lblA.Visible = True
Me.lblB.Visible = False
Me.lblC.Visible = False
ElseIf Me.chkA = True And Me.chkB = True And Me.chkC = False Then
Me.lblA.Visible = True
Me.lblB.Visible = True
Me.lblC.Visible = False
ElseIf etc....for all the combinations
End Sub
This sub then goes in the checkbox AfterUpdate and FormCurrent Subs
Is this a case for Select Case??
Thanks in advance
millrat
Can anyone help with a more elegant solution?
I have multiple checkboxes on a form. Each check box sets the visible property of a corresponding label. This works in the short term but as I add more check boxes (with more combinations) it will become unwieldy to code.
eg. (short version)
Sub lblVisible()
If Me.chkA = False And Me.chkB = False And Me.chkC = False Then
Me.lblA.Visible = False
Me.lblB.Visible = False
Me.lblC.Visible = False
ElseIf Me.chkA = True And Me.chkB = False And Me.chkC = False Then
Me.lblA.Visible = True
Me.lblB.Visible = False
Me.lblC.Visible = False
ElseIf Me.chkA = True And Me.chkB = True And Me.chkC = False Then
Me.lblA.Visible = True
Me.lblB.Visible = True
Me.lblC.Visible = False
ElseIf etc....for all the combinations
End Sub
This sub then goes in the checkbox AfterUpdate and FormCurrent Subs
Is this a case for Select Case??
Thanks in advance
millrat