check boxes to fill another check box

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!
 
G

Guest

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
 
D

Douglas J. Steele

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top