Hello
I'm developing a form that allows students to choose university module choices. I have a credit counter which keeps a running total of all selected modules credits. A module cannot be selected if it exceeds the credit limit for each semester.
One module is 'Management Dissertation' which is either worth 10 credits in semester 1 and 20 credits in semester 2 OR 20 credits in semester 1 and 10 credits in semester 2. Upon clicking the module, a yes/no/cancel msgbox appears asking which option they'd like - it updates the credits counter accordingly. However, I'm struggling to find a way of deducting those credits if the module is deselected.
This is my code so far - any thoughts?
'Management Dissertation
Private Sub mandistog_click()
Dim Response3
Dim Sem1CredVal As Integer
Dim Sem2CredVal As Integer
If ManDisTog.Value = True Then
Response3 = MsgBox("Management Dissertation can be counted as EITHER:" & Chr(13) & "a) 10 credits in Semester One and 20 credits in Semester Two" & Chr(13) & "OR" & Chr(13) & "b) 20 credits in Semester One and 10 credits in Semester Two" & Chr(13) & Chr(13) & "Click 'Yes' for option a) or 'No' for option b)", 35, "ALERT")
Select Case Response3
Case 6
Sem1CredVal = 10
Sem2CredVal = 20
If Sem1Cred.Value + Sem1CredVal <= Sem1TotCred.Value Then
Sem1Cred.Value = Sem1Cred.Value + Sem1CredVal
If Sem2Cred.Value + Sem2CredVal <= Sem2TotCred.Value Then
Sem2Cred.Value = Sem2Cred.Value + Sem2CredVal
Else
Call MsgBox("You cannot select more than a total of " & Sem2TotCred.Value & " credits in semester 2", vbExclamation, "ERROR")
ManDisTog.Value = False
End If
Else
Call MsgBox("You cannot select more than a total of " & Sem1TotCred.Value & " credits in semester 1", vbExclamation, "ERROR")
ManDisTog.Value = False
End If
Case 7
Sem1CredVal = 20
Sem2CredVal = 10
If Sem1Cred.Value + Sem1CredVal <= Sem1TotCred.Value Then
Sem1Cred.Value = Sem1Cred.Value + Sem1CredVal
If Sem2Cred.Value + Sem2CredVal <= Sem2TotCred.Value Then
Sem2Cred.Value = Sem2Cred.Value + Sem2CredVal
Else
Call MsgBox("You cannot select more than a total of " & Sem2TotCred.Value & " credits in semester 2", vbExclamation, "ERROR")
ManDisTog.Value = False
End If
Else
Call MsgBox("You cannot select more than a total of " & Sem1TotCred.Value & " credits in semester 1", vbExclamation, "ERROR")
ManDisTog.Value = False
End If
Case 2
ManDisTog.Value = False
End Select
End If
End Sub