I am building a time clock system where the employee can type there ssn and clock in or out using only one button. Ok everything is working except that I want to have the code below give me a updated total in hours and minutes of the total time an employee has worked but nothing is showing in the TotalTime table after I clock in. Any help.
Private Sub clock_Click()
If Me.SSN = DLookup("[SSN]", "Employees") Then
'--
Set rst = CurrentDb.OpenRecordset("SELECT * FROM [Employees] Where [Employees].[SSN]='" & Me.[SSN] & "'")
rst.Edit
rst![TotalTime].Value = rst![TotalTime].Value + rst![Time].Value - Now()
rst![Time].Value = Now()
rst.Update
rst.Close
'--
DoCmd.Close
Else
MsgBox "No Employee On File"
Me.SSN.SetFocus
End
End If
End Sub
Private Sub clock_Click()
If Me.SSN = DLookup("[SSN]", "Employees") Then
'--
Set rst = CurrentDb.OpenRecordset("SELECT * FROM [Employees] Where [Employees].[SSN]='" & Me.[SSN] & "'")
rst.Edit
rst![TotalTime].Value = rst![TotalTime].Value + rst![Time].Value - Now()
rst![Time].Value = Now()
rst.Update
rst.Close
'--
DoCmd.Close
Else
MsgBox "No Employee On File"
Me.SSN.SetFocus
End
End If
End Sub