I am creating a timeclock for sign in and signout. I need to check that the employee record is not already signed in (forgotten to sign out) before they sign in again.
I have a simple table with employeeid, signin and signout date/time.
How can I add to this code so that it checks for prevoius records where the signout record is null and the employeeid equals the loaded id
my inital code is:
Private Sub Cmdsignin_Click()
'this writes to the hours worked table - sign in
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("TBLhoursworked", dbOpenDynaset)
rs.AddNew
rs![Signin] = Me![TxtCurrenttime]
rs![EmployeeID] = Me![TXTCurrentloggedon]
rs.Update
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
DoCmd.Close acForm, "FRMtimeclock", acSaveNo
End Sub
Thanks.
I have a simple table with employeeid, signin and signout date/time.
How can I add to this code so that it checks for prevoius records where the signout record is null and the employeeid equals the loaded id
my inital code is:
Private Sub Cmdsignin_Click()
'this writes to the hours worked table - sign in
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("TBLhoursworked", dbOpenDynaset)
rs.AddNew
rs![Signin] = Me![TxtCurrenttime]
rs![EmployeeID] = Me![TXTCurrentloggedon]
rs.Update
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
DoCmd.Close acForm, "FRMtimeclock", acSaveNo
End Sub
Thanks.