J
James
Is there a way to make the hours fall under the currect days. For example
If something is scheduled on 6/25/03 12:00pm til 6/26/03 3:00am the it would
show the hours under that time not just aligned to the left. And how do you
show every hour on the timeline. I have included the code that I currently
have. Thank you in advance.
Option Compare Database
Option Explicit
Private mdatEarliest As Date
Private mdatLatest As Date
Private mintDayDiff As Integer
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim intStartDayDiff As Integer
Dim intDayDiff As Integer
Dim sngFactor As Single
On Error Resume Next
Me.ScaleMode = 1 'Twips
sngFactor = Me.boxMaxDays.Width / mintDayDiff
If Not IsNull(Me.StartDate) And Not IsNull(Me.EndDate) Then
Me.boxGrowForDate.Visible = True
Me.lblTotalDays.Visible = True
intStartDayDiff = Abs(DateDiff("h", Me.StartDate, mdatEarliest))
intDayDiff = Abs(DateDiff("h", Me.EndDate, Me.StartDate))
If intStartDayDiff = 0 Then intStartDayDiff = 1
With Me.boxGrowForDate
.Left = Me.boxMaxDays.Left + (intStartDayDiff * sngFactor)
.Width = intDayDiff * sngFactor
End With
Me.lblTotalDays.Left = Me.boxGrowForDate.Left
Me.lblTotalDays.Caption = intDayDiff & " Hour(s)"
Else '
Me.boxGrowForDate.Visible = False
Me.lblTotalDays.Visible = False
End If
End Sub
Private Sub Report_Open(Cancel As Integer)
Dim db As Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT Min([PUDate]) AS MinOfStartDate " _
& " FROM Projects", dbOpenSnapshot)
If rs.RecordCount > 0 Then
mdatEarliest = rs!MinOfStartDate
End If
Set rs = db.OpenRecordset("SELECT
Max(IIf(IsDate([DODate]),CDate([DODate]),Null)) " _
& "AS MaxOfEndDate FROM Projects", dbOpenSnapshot)
If rs.RecordCount > 0 Then
mdatLatest = rs!MaxOfEndDate
End If
mintDayDiff = DateDiff("h", mdatEarliest, mdatLatest)
Me.txtMinStartDate.Caption = Format(mdatEarliest, "mm/dd/yyyy")
Me.txtMaxEndDate.Caption = Format(mdatLatest, "mm/dd/yyyy")
Set rs = Nothing
Set db = Nothing
End Sub
If something is scheduled on 6/25/03 12:00pm til 6/26/03 3:00am the it would
show the hours under that time not just aligned to the left. And how do you
show every hour on the timeline. I have included the code that I currently
have. Thank you in advance.
Option Compare Database
Option Explicit
Private mdatEarliest As Date
Private mdatLatest As Date
Private mintDayDiff As Integer
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim intStartDayDiff As Integer
Dim intDayDiff As Integer
Dim sngFactor As Single
On Error Resume Next
Me.ScaleMode = 1 'Twips
sngFactor = Me.boxMaxDays.Width / mintDayDiff
If Not IsNull(Me.StartDate) And Not IsNull(Me.EndDate) Then
Me.boxGrowForDate.Visible = True
Me.lblTotalDays.Visible = True
intStartDayDiff = Abs(DateDiff("h", Me.StartDate, mdatEarliest))
intDayDiff = Abs(DateDiff("h", Me.EndDate, Me.StartDate))
If intStartDayDiff = 0 Then intStartDayDiff = 1
With Me.boxGrowForDate
.Left = Me.boxMaxDays.Left + (intStartDayDiff * sngFactor)
.Width = intDayDiff * sngFactor
End With
Me.lblTotalDays.Left = Me.boxGrowForDate.Left
Me.lblTotalDays.Caption = intDayDiff & " Hour(s)"
Else '
Me.boxGrowForDate.Visible = False
Me.lblTotalDays.Visible = False
End If
End Sub
Private Sub Report_Open(Cancel As Integer)
Dim db As Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT Min([PUDate]) AS MinOfStartDate " _
& " FROM Projects", dbOpenSnapshot)
If rs.RecordCount > 0 Then
mdatEarliest = rs!MinOfStartDate
End If
Set rs = db.OpenRecordset("SELECT
Max(IIf(IsDate([DODate]),CDate([DODate]),Null)) " _
& "AS MaxOfEndDate FROM Projects", dbOpenSnapshot)
If rs.RecordCount > 0 Then
mdatLatest = rs!MaxOfEndDate
End If
mintDayDiff = DateDiff("h", mdatEarliest, mdatLatest)
Me.txtMinStartDate.Caption = Format(mdatEarliest, "mm/dd/yyyy")
Me.txtMaxEndDate.Caption = Format(mdatLatest, "mm/dd/yyyy")
Set rs = Nothing
Set db = Nothing
End Sub