MS_Access_Amature
Registered User.
- Local time
- , 18:04
- Joined
- Nov 10, 2010
- Messages
- 56
I have a Table (Employees) with the following fields: EmployeeID, EmployeeName, DateOfWork, TimeIn, TimeOut, and DayTotal.
My form has a listbox (ListEmployees) and a ButtonPunchIn and a ButtonPunchOut.
Everything is working. But what I want is to add to the ButtonPunchOut On click procedure. I want it to calculate the time that employee worked that day. So in other words i want to see how long an employee worked that day using the DateDiff between TimeIn and TimeOut and putting that Value in the DayTotal field. My problem is i dont know what to put after DateDiff.
Private Sub ButtonPunchOut_Click()
Dim db As DAO.Database, strMyValue As String, datMyValue As Date
strMyValue = Me.listEmployee
datMyValue = Now()
Set db = CurrentDb
db.Execute "Update Employee set TimeOut=Now() where EmployeeName=('" & strMyValue & "') "
Dim Total as Integer
Total = DateDiff("n",?????)
End Sub
Can someone please explain to me. Or should i use a different function??
My form has a listbox (ListEmployees) and a ButtonPunchIn and a ButtonPunchOut.
Everything is working. But what I want is to add to the ButtonPunchOut On click procedure. I want it to calculate the time that employee worked that day. So in other words i want to see how long an employee worked that day using the DateDiff between TimeIn and TimeOut and putting that Value in the DayTotal field. My problem is i dont know what to put after DateDiff.
Private Sub ButtonPunchOut_Click()
Dim db As DAO.Database, strMyValue As String, datMyValue As Date
strMyValue = Me.listEmployee
datMyValue = Now()
Set db = CurrentDb
db.Execute "Update Employee set TimeOut=Now() where EmployeeName=('" & strMyValue & "') "
Dim Total as Integer
Total = DateDiff("n",?????)
End Sub
Can someone please explain to me. Or should i use a different function??