Hi,
I'm creating a simple timeclock which I would like to have a running daily total of their hours during the day. For example, if they've clockin and then clock out for lunch it would give them their hours worked and then when they clocked out for the day it would give them the total hours for the day minus lunchtime.
I have a module which calculates the time - it works perfectly if all punch fields have time in them. When there is a NULL time field it returns #ERROR in the field on teh form.
My tables fields are clockin1, clockout1(lunch out), clockin2 (lunch in), and clockout2.
here is my code:
Dim interval As Double
If IsNull(IN1) = True And IsNull(OUT1) = True And IsNull(IN2) = True And IsNull(OUT2) = True Then Exit Function
If IsNull(IN1) = False And IsNull(OUT1) = False And IsNull(IN2) = True And IsNull(OUT2) = True Then
interval = OUT1 - IN1
ElseIf IsNull(IN1) = False And IsNull(OUT1) = False And IsNull(IN2) = False And IsNull(OUT2) = True Then
interval = OUT1 - IN1
ElseIf IsNull(IN1) = False And IsNull(OUT1) = False And IsNull(IN2) = False And IsNull(OUT2) = False Then
interval = ((OUT2 - IN1) - (IN2 - OUT1))
ElseIf IsNull(IN1) = False And IsNull(OUT1) = True And IsNull(IN2) = True And IsNull(OUT2) = True Then
interval = OUT2 - IN1
Else
interval = 0
End If
When I step through the code - it doesn't seem to recognize a NULL datetime field. What am I doing wrong?
Lisa