Hi!
Background: We have shifts working from 23h00 to 06h00. However I would like to add a column with the Starting date of the shift, to be able to sort on that in reports.
SID - Shift ID
StartDatum = start of shift
DatumTid = time stamp of record
Code:
Dim szTime As String
szTime = Time
If (MyRs![SID] = 3 Or MyRs![SID] = 5 Or MyRs![SID] = 6) _
And (TimeValue(szTime) > "00:00:00" Or TimeValue(szTime) < "17:00:00") Then
MyRs![StartDatum] = CDate(MyRs![DatumTid]) - 1
ElseIf (MyRs![SID] <> 3 Or MyRs![SID] <> 5 Or MyRs![SID] <> 6) Then
MyRs![StartDatum] = CDate(MyRs![DatumTid])
End If
Why does it not work? What to do to make it work?
I always get StartDatum = DatumTid
Thanks for help