Private Sub CmdAdd_Click()
If IsNull(Me.ComboFiscal) Then ' No business unit
MsgBox ("Please add Fiscal Year!"), vbOKCancel ' Tell user
Me.ComboFiscal.SetFocus ' Focus the control
Exit Sub ' Exit the method
End If ' End the IsNull test
If IsNull(Me.txtContact) Then ' No business unit
MsgBox ("Please add Contact!"), vbOKCancel ' Tell user
Me.txtContact.SetFocus ' Focus the control
Exit Sub ' Exit the method
End If ' End the IsNull test
If IsNull(Me.ComboMonth) Then ' No business unit
MsgBox ("Please add Month!"), vbOKCancel ' Tell user
Me.ComboMonth.SetFocus ' Focus the control
Exit Sub ' Exit the method
End If ' End the IsNull test
If Nz(Me.TxtActualBenchmark, "") = "" And Me.Comboyesorno.Visible = False Then ' No business unit
MsgBox ("Please add Results!"), vbOKCancel ' Tell user
Me.txtContact.SetFocus ' Focus the control
Exit Sub ' Exit the method
End If ' End the IsNull test
If (Me.ComboGoals.Value = "") Then ' No business unit
MsgBox ("Please add Goals!"), vbOKCancel ' Tell user
Me.ComboGoals.SetFocus ' Focus the control
Exit Sub ' Exit the method
End If ' End the IsNull test
If Nz(Me.Comboyesorno, "") = "" And Me.Comboyesorno.Visible = True Then ' No business unit
MsgBox ("Please add Yes or No!"), vbOKCancel ' Tell user
Me.txtContact.SetFocus ' Focus the control
Exit Sub ' Exit the method
End If ' End the IsNull test
Select Case TxtActualBenchmark
Case "N/A"
Case "At least one program every 6 months"
Select Case Me.ComboMonth
Case "January", "February", "March", "April", "May", "July", "August", "September", "October", "November"
MsgBox "Please put N/A", vbOKCancel
Case "June", "December"
'do nothing
End Select
Case Else 'or NOT "N/A"
'SOMETHIN
End Select
Select Case TxtActualBenchmark
Case "N/A"
Case "25% Implemented every 4 months"
Select Case Me.ComboMonth
Case "January", "February", "March", "May", "July", "September", "October", "November"
MsgBox "Please put N/A", vbOKCancel
Case "April", "August", "December"
'do nothing
End Select
Case Else 'or NOT "N/A"
'SOMETHIN
End Select
If IsNumeric(Me.TxtActualBenchmark) = "False" Then
Select Case Me.ComboGoals.Column(2)
Case 1, 4, 6, 10, 11, 12, 13, 22, 23, 24, 25, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 46, 47, 48, 50, 51, 56, 59, 61, 74, 75, 79, 80, 84, 85, 86, 87, 88, 89, 90, 91, 96, 99, 100, 108, 110, 112, 115, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 141, 142, 143, 144, 145, 146, 147, 148, 149, 152, 153, 154, 156, 158, 159, 160, 161, 162, 163, 164, 165, 166, 171, 172, 173, 174, 184, 185, 186, 187, 188, 190, 191, 192, 193, 195, 196, 197, 200, 204, 205, 208, 209, 210, 211, 213, 214, 216, 219
Me.TxtActualBenchmark.Undo
MsgBox "Please enter a numeric value ", _
vbInformation, "Missing Information"
End Select
Exit Sub
End If
If InStr(Me.TxtActualBenchmark, ".") = 0 Then
Select Case Me.ComboGoals.Column(2)
Case 2, 3, 9, 20, 43, 45, 54, 55, 58, 60, 97, 103, 116, 117, 150, 167, 168, 169, 182, 194, 199, 201, 207
MsgBox "Please enter a decimal", vbInformation, "Missing Information"
Cancel = True
End Select
Exit Sub
End If
'Add data to form
CurrentDb.Execute "INSERT INTO Scorecards (ForTheMonth,FiscalYear,Groups,Contact,Goals,Bench marks,Results,Comments,MetGoal)" & _
"VALUES('" & Me.ComboMonth & "','" & Me.ComboFiscal & "','" & Me.ComboDepartment & "','" & Me.txtContact & "','" & Me.ComboGoals & "','" & Me.txtBenchmarks & "','" & Me.TxtActualBenchmark & "','" & Me.txtComments & "','" & Me.txtMetGoal & "');"
'message box
'Requery Form
frmscorecardssub.Form.Requery
'Clear Form
CmdClear_Click
End Sub