Option Compare Database
'Add New Employee to Database and Return to Employee Management Form
Private Sub cmdAdd_Click()
On Error GoTo Err_cmdAdd_Click
If (IsNull([FirstName]) = True) Or (IsNull([LastName]) = True) Or (IsNull([Rate]) = True) Then
MsgBox "One or more required fields are empty.", vbCritical, "Infoscitex Corporation PMBS"
Exit Sub
Else
DoCmd.Close
End If
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "fmnuEmployees"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdAdd_Click:
Exit Sub
Err_cmdAdd_Click:
MsgBox Err.Description
Resume Exit_cmdAdd_Click
End Sub
'Cancel Adding New Employee and Return to Employee Management Form
Private Sub cmdCancel_Click()
On Error GoTo Err_cmdCancel_Click
If (IsNull([FirstName]) = False) Or (IsNull([LastName]) = False) Or (IsNull([Rate]) = False) Or (IsNull([Email]) = False) Then
DoCmd.RunCommand acCmdDeleteRecord
End If
DoCmd.Close
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "fmnuEmployees"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdCancel_Click:
Exit Sub
Err_cmdCancel_Click:
MsgBox Err.Description
Resume Exit_cmdCancel_Click
End Sub