I have this validation code behind the sumit command button
The validation portion is not working. If the Type or Effort IsNull it is going ahead and saving the record and closing. I'm not get the Msg Box.
Code:
On Error GoTo Err_cmdSubmit_Click
If IsNull(Approval) Then
MsgBox "Approval must be entered before you can submit the record.", vbCritical, "Invalid Save"
cboTO.SetFocus
ElseIf IsNull(Type) Then
MsgBox "Type must be entered before you can Submit the record.", vbCritical, "Invalid Save"
cboJobType.SetFocus
ElseIf IsNull(Effort) Then
MsgBox "Effort must be entered before you can Submit the record.", vbCritical, "Invalid Save"
cboJobType.SetFocus
Else
'Save the record
DoCmd.RunCommand acCmdSaveRecord
'Requery the listbox
Me.WorkLst.Requery
'Notify user log submitted
'MsgBox "Work Log Entry Submitted", vbOKOnly + vbInformation, "Log Sumitted"
'Close the form
' DoCmd.Close acForm, Me.Name
End If
Exit_cmdSubmit_Click:
Exit Sub
Err_cmdSubmit_Click:
MsgBox Err.Description
Resume Exit_cmdSubmit_Click
The validation portion is not working. If the Type or Effort IsNull it is going ahead and saving the record and closing. I'm not get the Msg Box.