Progress Meter or Gauge

  • Thread starter Thread starter MSJ
  • Start date Start date
M

MSJ

On my reports in Access 2000 I wanted to show how close an employee
was to hitting a quota by showing them a progress bar that moves up
and down a scale from 0 - 100% with hopefully some ability to adjust
the color of the bar as it progresses further like (Red - Yellow -
Green)
 
Assuming you have a text box named "QuotaPct" containing a value of between 0
and 1. Add a rectangle to your report in the same section that is the size of
your progress bar. Add code to the On Format event of your report section to
set a color and draw a rectangle of the proper size inside the progress bar.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim intLeft As Integer
Dim intWidth As Integer
Dim intHeight As Integer
Dim intTop As Integer
Dim lngColor As Long
intLeft = Me.boxBar.Left 'left position of rectanble
intWidth = Me.boxBar.Width 'width of rectangle
intTop = Me.boxBar.Top 'top of rectangle
intHeight = Me.boxBar.Height 'height of rectangle
'draw bar
Select Case Me.QuotaPct
Case Is < 0.5
lngColor = vbRed
Case Is < 0.75
lngColor = vbYellow
Case Else
lngColor = vbGreen
End Select
intTop = intTop + (1 - Me.QuotaPct) * intHeight
intHeight = Me.QuotaPct * intHeight
Me.Line (intLeft, intTop)-Step(intWidth, intHeight), lngColor, BF
End Sub
 
Thank you both for the suggestions. I will let you know how it works
out in the next few days.

Thanks again
 
So The solution doesn't work for me... but I have identified why...
and maybe there is an easy fix.

I am not doing the chart under the Detail section of the report, it is
within a specific header. The Me.Line command seems to only work
under the detail. Is there a fix to that?

Thank you
 
Oops, my mistake, I completely passed by the *report* part.  Why not use
Duane's solution in a subreport in the individual Group header?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm








- Show quoted text -

It took me awhile but I figured it out... I had to change a few of the
fields for my purposes, but the background was all there.

Thanks again
 
You can use the line method in a group section as long as the values used are
bound to controls in the same section.
 
Back
Top