I made a ballot for a yearly election using checkboxes but, I need to make sure that only (6) six candidates are choosen, so I created a event procedure in the on current field. Here it goes (though its been butcher about 10 times.) Can someone help me and tell me where I went wrong?
Dim CAN01, CAN02, CAN03, CAN04, CAN05, CAN06, CAN07, CAN08, CAN09, CAN10 As Boolean
Dim TotalVotes As IntegerDim TotalVotes As Integer
If CAN01 = -1 Then
TotalVotes = TotalVotes + 1
ElseIf CAN02 = -1 Then
TotalVotes = TotalVotes + 1
ElseIf CAN03 = -1 Then
TotalVotes = TotalVotes + 1
If TotalVotes >= -6 Then
MsgBox "To many Candidate selected", vbAbortRetryIgnore, "Votes Exceeded"
End If
This is the short version.
Dim CAN01, CAN02, CAN03, CAN04, CAN05, CAN06, CAN07, CAN08, CAN09, CAN10 As Boolean
Dim TotalVotes As IntegerDim TotalVotes As Integer
If CAN01 = -1 Then
TotalVotes = TotalVotes + 1
ElseIf CAN02 = -1 Then
TotalVotes = TotalVotes + 1
ElseIf CAN03 = -1 Then
TotalVotes = TotalVotes + 1
If TotalVotes >= -6 Then
MsgBox "To many Candidate selected", vbAbortRetryIgnore, "Votes Exceeded"
End If
This is the short version.