SteveL13
asked on
Stop data entry if certain criteria exists
I have a time reporting database that has a form with a start and stop time.
When the employee selects their name from a combo box and if they haven't entered a stop time in their previous transaction I have a message box appearing. But the problem is, the message box is appearing for any employee even if they don't have "un-ended" transactions.
Here is my code. Can someone spot the problem for me?
If IsNull(DMax("[StopTime]", "tblLaborTranx", "[EmployeeID] = " & Forms!frmEmployeeLaborTran x!txtEmplo yeeID)) Then
MsgBox "You have not logged out of your last labor transaction. Please be sure to log out of it or see the front office for editing."
DoCmd.Close acForm, "frmEmployeeLaborTranx", acSaveNo
Exit Sub
End If
I also have tried:
If DMax("[StopTime]", "tblLaborTranx", "[EmployeeID] = " & Forms!frmEmployeeLaborTran x!txtEmplo yeeID) = "" Then
MsgBox "You have not logged out of your last labor transaction. Please be sure to log out of it or see the front office for editing."
DoCmd.Close acForm, "frmEmployeeLaborTranx", acSaveNo
Exit Sub
End If
But that doesn't work either.
--Steve
When the employee selects their name from a combo box and if they haven't entered a stop time in their previous transaction I have a message box appearing. But the problem is, the message box is appearing for any employee even if they don't have "un-ended" transactions.
Here is my code. Can someone spot the problem for me?
If IsNull(DMax("[StopTime]", "tblLaborTranx", "[EmployeeID] = " & Forms!frmEmployeeLaborTran
MsgBox "You have not logged out of your last labor transaction. Please be sure to log out of it or see the front office for editing."
DoCmd.Close acForm, "frmEmployeeLaborTranx", acSaveNo
Exit Sub
End If
I also have tried:
If DMax("[StopTime]", "tblLaborTranx", "[EmployeeID] = " & Forms!frmEmployeeLaborTran
MsgBox "You have not logged out of your last labor transaction. Please be sure to log out of it or see the front office for editing."
DoCmd.Close acForm, "frmEmployeeLaborTranx", acSaveNo
Exit Sub
End If
But that doesn't work either.
--Steve
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.