check boxes to fill another check box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 9 check boxes on my form for Sessions 1-9. I have an additional check
box "Completed" which I only check if Sessions 1-9 are checked. Can I
automate the Completed box to be checked when the first nine boxes are
checked?

Thank you!
 
Call the following function from the After Update event of all 9 session
check boxes. Just change the names of the controls to the real names you use.

Private Sub CheckTheChecks() As Boolean
Dim lngTot As Long

With Me
lngTot = .Chk1 + .Chk2 + .Chk2 + .Chk2 + .Chk2 + .Chk2 + .Chk2 +
..Chk2 + .Chk2
.chkCompleted = lngTot = -9
End With
End Function
 
You meant, of course,

Private Sub CheckTheChecks() As Boolean
Dim lngTot As Long

With Me
lngTot = .Chk1 + .Chk2 + .Chk3 + .Chk4 + .Chk5 + .Chk6 + .Chk7 + .Chk8 +
..Chk9
.chkCompleted = (lngTot = -9)
End With

End Function

(you forgot to complete your renumbering of the check box names)

Another alternative would be

Private Sub CheckTheChecks() As Boolean
Dim lngTot As Long

With Me
lngTot = .Chk1 * .Chk2 * .Chk3 * .Chk4 * .Chk5 * .Chk6 * .Chk7 *.Chk8 *
..Chk9
.chkCompleted = (lngTot <> 0)
End With

End Function
 
Back
Top