N
NKA
I have created a timeline (gantt style) report using the Timeline example
from the Access Web.
I haven't modified the code in any shape or form other than to change field
names.
My minDate is always Date() and my maxDate is variable.
My current data set has a max of 215 days.
When I run the report, the timelines all look great, bar one - which is the
one task that spans the whole 215 days. I expect to see the 'bar' span the
entire width of the timeline - but it doesn't! It sits at what looks to be
about 5 days!!
The line of code to determine the width of the timeline is
.Width = intDayDiff * sngFactor
The values translate as
.Width = 215 * 54.9907 (which equals 11823.0005) but the value returned
for .Width is 284 ?????
Coding is not my strong point - so I am at an absolute loss now as another
extended date (31/03/2009) which is 124 days, works fine!
I have pasted the code below in the hope someone might be able to assist.
Many thanks
NKA
The code is:
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 ' calculate max width of
timeline, divide by max no of days to get single value
If Not IsNull(Me.StartDate) And Not IsNull(Me.EndDate) Then
Me.boxGrowForDate.Visible = True
Me.lblTotalDays.Visible = True
intStartDayDiff = Abs(DateDiff("d", Me.StartDate, mdatEarliest))
intDayDiff = Abs(DateDiff("d", 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.Left = Me.boxGrowForDate.Left + Me.boxGrowForDate.Width
Me.lblTotalDays.Caption = intDayDiff & " day(s)"
Else
Me.boxGrowForDate.Visible = False
Me.lblTotalDays.Visible = False
End If
from the Access Web.
I haven't modified the code in any shape or form other than to change field
names.
My minDate is always Date() and my maxDate is variable.
My current data set has a max of 215 days.
When I run the report, the timelines all look great, bar one - which is the
one task that spans the whole 215 days. I expect to see the 'bar' span the
entire width of the timeline - but it doesn't! It sits at what looks to be
about 5 days!!
The line of code to determine the width of the timeline is
.Width = intDayDiff * sngFactor
The values translate as
.Width = 215 * 54.9907 (which equals 11823.0005) but the value returned
for .Width is 284 ?????
Coding is not my strong point - so I am at an absolute loss now as another
extended date (31/03/2009) which is 124 days, works fine!
I have pasted the code below in the hope someone might be able to assist.
Many thanks
NKA
The code is:
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 ' calculate max width of
timeline, divide by max no of days to get single value
If Not IsNull(Me.StartDate) And Not IsNull(Me.EndDate) Then
Me.boxGrowForDate.Visible = True
Me.lblTotalDays.Visible = True
intStartDayDiff = Abs(DateDiff("d", Me.StartDate, mdatEarliest))
intDayDiff = Abs(DateDiff("d", 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.Left = Me.boxGrowForDate.Left + Me.boxGrowForDate.Width
Me.lblTotalDays.Caption = intDayDiff & " day(s)"
Else
Me.boxGrowForDate.Visible = False
Me.lblTotalDays.Visible = False
End If