jeudi 1 septembre 2016

Check Checkbox from 1 Group to Another

Good Morning I want to ask something that is related in checkboxes I have to groups of checkboxes and it looks like this

enter image description here

My question is How can i check the checkbox Purchase Requisition whenever i check any checkbox in Group Purchase Requisition and if all of them are uncheck then checkbox Purchase Requisition is unchecked.

I have this code and I put this code on all of the checkbox inside Groupbox Purchase Requisition

  Sub check_Purchase_Req()
        Dim oCtl As Control
        Dim iX As Integer

        For Each oCtl In GroupBox3.Controls
            If TypeName(oCtl) = "CheckBox" And oCtl.Enabled = True Then iX = iX + 1

            If iX > 0 Then
                CheckBox1.Checked = True

            ElseIf CheckBox19.Checked = False And CheckBox20.Checked = False And CheckBox21.Checked = False And CheckBox22.Checked = False And CheckBox23.Checked = False Then

                CheckBox1.Checked = False
                Exit For
            End If
        Next
    End Sub

but this code doesnt meet what I need

Any help is appreciated TYSM




Aucun commentaire:

Enregistrer un commentaire