Hi all,
I have been trying out dhookom’s calendar ( works great but my problem is that I want to use it for shifts where some may be overnight, i.e. start at 10.00pm one day and run through to 8.00am the next day.
I have been using the following code to try to do this and incrementing one day for the second part of the shift, but I can only get the calendar to display the part of the shift on the following day. I am assuming that the table row is only called once, but somehow, I need to get the code to call the same row twice. Not sure if I am on the right track. If anyone has any ideas, please let me know.
Thanks
Zippy
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim lngTopMargin As Long
Dim lngOneMinute As Long 'size of one minute in twips
Dim datSchedStart As Date
Dim datEndTime As Date
Dim datStartTime As Date
Dim datShiftDate As Date
datSchedStart = #1:00:00 AM#
lngOneMinute = 6 'number of twips in one minute
lngTopMargin = 720 'timeline starts 1/2" down in section
datEndTime = Me.EndTime
datStartTime = Me.StartTime
datShiftDate = Me.ShiftDate
If datEndTime < datStartTime Then
datEndTime = #11:59:59 PM#
Me.MoveLayout = False
Me.StaffId.Top = lngTopMargin + DateDiff("n", datSchedStart, datStartTime) * lngOneMinute
Me.StaffId.Height = DateDiff("n", datStartTime, datEndTime) * lngOneMinute
Me.StaffId.Left = DateDiff("d", Me.WeekOf, Me.ShiftDate) * 1875
datShiftDate = DateAdd("d", 1, Me.ShiftDate)
Me.StaffId.Top = lngTopMargin + lngOneMinute
Me.StaffId.Height = DateDiff("n", datSchedStart, Me.EndTime) * lngOneMinute
Me.StaffId.Left = DateDiff("d", Me.WeekOf, datShiftDate) * 1875
Else
Me.MoveLayout = False
Me.StaffId.Top = lngTopMargin + DateDiff("n", datSchedStart, Me.StartTime) * lngOneMinute
Me.StaffId.Height = DateDiff("n", Me.StartTime, Me.EndTime) * lngOneMinute
Me.StaffId.Left = DateDiff("d", Me.WeekOf, Me.ShiftDate) * 1875
End If
End Sub
I have been trying out dhookom’s calendar ( works great but my problem is that I want to use it for shifts where some may be overnight, i.e. start at 10.00pm one day and run through to 8.00am the next day.
I have been using the following code to try to do this and incrementing one day for the second part of the shift, but I can only get the calendar to display the part of the shift on the following day. I am assuming that the table row is only called once, but somehow, I need to get the code to call the same row twice. Not sure if I am on the right track. If anyone has any ideas, please let me know.
Thanks
Zippy
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim lngTopMargin As Long
Dim lngOneMinute As Long 'size of one minute in twips
Dim datSchedStart As Date
Dim datEndTime As Date
Dim datStartTime As Date
Dim datShiftDate As Date
datSchedStart = #1:00:00 AM#
lngOneMinute = 6 'number of twips in one minute
lngTopMargin = 720 'timeline starts 1/2" down in section
datEndTime = Me.EndTime
datStartTime = Me.StartTime
datShiftDate = Me.ShiftDate
If datEndTime < datStartTime Then
datEndTime = #11:59:59 PM#
Me.MoveLayout = False
Me.StaffId.Top = lngTopMargin + DateDiff("n", datSchedStart, datStartTime) * lngOneMinute
Me.StaffId.Height = DateDiff("n", datStartTime, datEndTime) * lngOneMinute
Me.StaffId.Left = DateDiff("d", Me.WeekOf, Me.ShiftDate) * 1875
datShiftDate = DateAdd("d", 1, Me.ShiftDate)
Me.StaffId.Top = lngTopMargin + lngOneMinute
Me.StaffId.Height = DateDiff("n", datSchedStart, Me.EndTime) * lngOneMinute
Me.StaffId.Left = DateDiff("d", Me.WeekOf, datShiftDate) * 1875
Else
Me.MoveLayout = False
Me.StaffId.Top = lngTopMargin + DateDiff("n", datSchedStart, Me.StartTime) * lngOneMinute
Me.StaffId.Height = DateDiff("n", Me.StartTime, Me.EndTime) * lngOneMinute
Me.StaffId.Left = DateDiff("d", Me.WeekOf, Me.ShiftDate) * 1875
End If
End Sub