Calculating Time Clock

  • Thread starter Thread starter gobarr
  • Start date Start date
G

gobarr

Guest
I have developed a form in which users can clock in and out for the purposes of recording the amout of time employees have worked. This form simply asks for the user to type in a number (ClockInNumber) and then you can press the button "clock in" or "clock out". The table that this information is sent to is simply 4 fields: ClockInNumber, TimeInOut, InOut, and Date where ClockInNumber is simply their punch in number, TimeInOut is where the current time is stored(e.g. "8:00 AM"), InOut is a field who's value is set to "IN" or "OUT" depending on which button they press, and Date is where the current date is set(e.g. "5/5/04"). I am trying to figure out a way to add up all the times for each employee. I have tried a crosstab query but have been unsuccessful with it. I am not sure how to get it to add up the times between each "IN" and "OUT" pair for each employee for a particular 2 week cycle. I havn't even been able to find a way to add up their hours for a particular day. Given that a particular employee may punch in an out more than once during each day to allow for lunch, it can get kind of complex or at least in my head it does.
 
I would start by reading each employees' In/Out time stamps into a two dimensional array (2 by n) where the first element (1,1) has time In and the second element (2,1) has the subsequent time Out. The next set of array elements have the next In (1,2) and Out (2,2) time stamps for that employee. And so on (1,n) to (2,n).

Then use DateDiff in a loop that finds the difference between each set of In (1,n) and Out times (2,n) in minutes (or hours or what not...) and add that to a running total.

Hope that'll get get you started...
 
Check out the attached - doesn't use any arrays at all...

The included table that tracks employees in/out times has only 3 fields: EmpID, TimeStamp, In/Out.

Open the form Main and see what you think. It should get you started...
 

Attachments

Users who are viewing this thread

Back
Top Bottom