MS Access GNATT Chart Problems….HELP!
This is a bit confusing but thought maybe someone might have an idea.
I am creating a Gantt chart using a MS Access report. The report displays a list of projects our company is working on and it spans from January 20011 through January 2014. (Total of approximately 650 projects) and is broken down by months.
Most of the “Bars” on the chart display correctly…. The problem comes when a “Bar” width exceeds the width of the report. (i.e. project end date beyond December 2014) I check to see if the end of the Bar is greater than 14550 twips (that is approx 1 inch from the right edge of the report)
Calculating the bar location:
January 2011 is 1980 twips from the left side of the report. (This would be the starting point for and bar) so if the project start date is in the january of 2011, the SLOC (Starting Location) would = 1980.
Then I calculate how many months between the start and completion and multiple that times 330. (330 is the number of twips between each month) so if we have 4 months between start and end I multiply 330*4 = 1320 twips wide.
With me so far….?
Given the above we would have a bar with Left=1980 and Width=1320.
First bar on the chart! That was easy.
NOW FOR THE PROBLEM…
Now let’s say our start date is December 2013 (35 months from our base line of January 2011) so that would make our SLOC 35 * 330=11550+(our starting point 1980 twips) (Bar.Left = 13530). And our project is 6 months long (6*330=1980)so…. SLOC and WD = 15510 twips to the end of this project which exceeds the width of the report.
(boxGrowForDate is the name of the bar)
If (Sloc + WD >= 14550) Then
Me.boxGrowForDate.Left = Sloc
Me.boxGrowForDate.Width = (WD - ((Sloc + WD) - 14000))
Me.Post10.Visible = True
Me.BoxLabel.Left = Sloc
Else
Me.boxGrowForDate.Left = Sloc
Me.boxGrowForDate.Width = WD
Me.Post10.Visible = False
Me.BoxLabel.Left = Sloc
End If
For some reason after trimming the size of the bar (making the width smaller) sometime the bar staring location gets pushed way over to the left hand side of the report. Its like the bar is trying to exceed the width of the report…. But it shouldn’t be. And it only happens on some of the projects that extend to far into 2014.
I know this is a little confusing but any help would be appreciated!
Thanks
Gary