vendredi 12 juin 2020

How do I make a combobox visible/invisible depending on checkbox value?

I have a userform that contains two sets of comboboxes that depend on checkboxes each to be made visible. Upon the userform opening they are invisible. Upon checking the box the two fields become visible.
enter image description here

The comboboxes under the "CC MACH" checkbox work perfectly. They default to NOT visible upon loading the userform and only become visible upon checking the box...and become invisible if I uncheck the box.

enter image description here

But the comboboxes under neath "Label Printer", although they default to NOT visible upon loading, they do not become visible when I click the box...nor when I uncheck them.

enter image description here

The code that used for the CC MACH dependent boxes is the following:

Private Sub nd_ccmach_cx_Click()
If nd_ccmach_cx = True Then
    nd_ccmach_cb.Visible = True
    nd_ccip_lbl.Visible = True
    nd_ccip_cb.Visible = True
 Else
    If nd_ccmach_cx = False Then
       nd_ccmach_cb.Visible = False
       nd_ccip_lbl.Visible = False
       nd_ccip_cb.Visible = False
    End If
 End If
End Sub

The one for the Label Printer dependent boxes is as follows:

Private Sub nd_lblptr_cx_Click()
If nd_lblprt_cx = False Then
    nd_lblptr_cb.Visible = False
    nd_lblptr_usbip_lbl.Visible = False
    nd_usbip_cb.Visible = False
Else
    If nd_lblprt_cx = True Then
        nd_lblptr_cb.Visible = True
        nd_lblptr_usbip_lbl.Visible = True
        nd_usbip_cb.Visible = True
    End If
End If
End Sub

The Userform Initialize code is a follows:

 nd_ccmach_cb.Visible = False
    nd_ccip_lbl.Visible = False
    nd_ccip_cb.Visible = False

    nd_lblptr_cb.Visible = False
    nd_lblptr_usbip_lbl.Visible = False
    nd_usbip_cb.Visible = False

Can you please tell me why the "Label Printer" dependent boxes will not respond to the checkbox value?




Aucun commentaire:

Enregistrer un commentaire