Hello everyone, I got some problems with one of my codes. I am making a database where a person can tick boxes and chose 60credits from existing 120. But somehow my if function does not calculate the total..and at the end I get Message "Please chose 30credits per semester"
I would appreciate some help! Thank you :)
I would appreciate some help! Thank you :)
Code:
Option Compare Database Private Sub ModuleOptions_Click() Dim International_Business_1 As Integer Dim Business_Programming_1 As Integer Dim Decision_Making As Integer Dim Change_Management As Integer Dim Business_Planning As Integer Dim Small_Business_Issues As Integer Dim Decision_Analysis As Integer Dim International_Business_2 As Integer Dim Business_Programming_2 As Integer Dim Business_Finance As Integer Dim Corporate_Strategy As Integer Dim Career_Management As Integer Dim Business_Ethics As Integer Dim Corporate_Finance As Integer Dim Semester1 As Integer Dim Semester2 As Integer Semester1 = 0 Semester2 = 0 If International_Business_1 = 0 And International_Business_2 = 20 Then MsgBox "You cannot select International Business 2 in semester 2 unless International Business 1 in semester 1 is selected.", vbCritical, "Incorrect choice" Exit Sub End If If Business_Programming_1 = 0 And Business_Programming_2 = 20 Then MsgBox "You cannot select Business Programming 2 in semester 2 unless Business Programming 1 in semester 1 is selected.", vbCritical, "Incorrect choice" Exit Sub End If If Decision_Making = 20 And Decision_Analysis = 10 Then MsgBox "You cannot select both Decision Making and Decision Analysis because of the common material shared", vbCritical, "Incorrect choice" Exit Sub End If If Business_Finance = 20 And Corporate_Finance = 10 Then MsgBox "You cannot select both Business Finance and Corporate Finance because of the common material shared", vbCritical, "Incorrect choice" Exit Sub End If If Business_Planning = 10 And Corporate_Strategy = 10 Then MsgBox "You cannot select both Business Planning and Corporate Strategy because of the common material shared", vbCritical, "Incorrect choice" Exit Sub End If If Management_Dissertation = 20 Then Semester1 = Semester1 + 10 Semester2 = Semester2 + 10 End If InternationalBusiness1.Value = International_Business_1 BusinessProgramming1.Value = Business_Programming_1 DecisionMaking.Value = Decision_Making ChangeManagement.Value = Change_Management BusinessPlanning.Value = Business_Planning SmallBusinessIssues.Value = Small_Business_Issues DecisionAnalysis.Value = Decision_Analysis InternationalBusiness2.Value = International_Business_2 BusinessProgramming2.Value = Business_Programming_2 BusinessFinance.Value = Business_Finance CorporateStrategy.Value = Corporate_Strategy CareerManagement.Value = Career_Management BusinessEthics.Value = Business_Ethics CorporateFinance.Value = Corporate_Finance Semester1 = (Semester1 + International_Business_1 + Business_Programming_1 + Decision_Making + Change_Management + Business_Planning + Small_Business_Issues + Decision_Analysis) Semester2 = (Semester2 + International_Business_2 + Business_Programming_2 + Business_Finance + Corporate_Strategy + Career_Management + Business_Ethics + Corporate_Strategy) If Semester1 <> 30 Or Semester2 <> 30 Then MsgBox "Each semester should consist of 30 credits.", vbOKOnly + vbCritical, "Incorrect choice" Exit Sub Else MsgBox "Thank you for your time. Confirmation letter has been sent to your email adress.", vbOKOnly + vbExclamation, "Choice confirmation" End If DoCmd.RunCommand acCmdSaveRecord DoCmd.OpenReport "Module Options", acViewPreview, , "[StudentID] = '" & [StudentID] & "'" End Sub
Comment