not tested:
Code:
Dim tf As Boolean
Dim n1 As Double, n2 As Double, n3 As Double, n4 As Double
Dim s1 As String, s2 As String, s3 As String, s4 As String
n1 = Nz([s1], 0): n2 = Nz([s2], 0): n3 = Nz([s3], 0): n4 = Nz([s4], 0)
s1 = [class1] & "": s2 = [class2] & "": s3 = [class3] & "": s4 = [class4] & ""
tf = False
Select Case True
Case n4 <> 0
If (n1 + n2 + n3 + n4) = 100 Then
If Len(s1) = 0 Or Len(s2) = 0 Or Len(s3) = 0 Or Len(s4) = 0 Then
MsgBox "Please enter the name of all 4 classes!"
tf = True
End If
Else
MsgBox "Please make sure that the total of 4 scores is equal to 100."
tf = True
End If
Case n3 <> 0
If (n1 + n2 + n3) = 100 Then
If Len(s1) = 0 Or Len(s2) = 0 Or Len(s3) = 0 Then
MsgBox "Please enter the name of all 3 classes!"
tf = True
End If
Else
MsgBox "Please make sure that the total of 3 scores is equal to 100."
tf = True
End If
Case n2 <> 0
If (n1 + n2) = 100 Then
If Len(s1) = 0 Or Len(s2) = 0 Then
MsgBox "Please enter the name of all 2 classes!"
tf = True
End If
Else
MsgBox "Please make sure that the total of 2 scores is equal to 100."
tf = True
End If
Case Else
If n1 = 100 Then
If Len(s1) = 0 Then
MsgBox "Please enter the name of 1st class!"
tf = True
End If
Else
MsgBox "Please make sure that score1 is 100."
tf = True
End If
End Select
Cancel = tf