See Below!
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
[email protected]
www.pcdatasheet.com
If you can't get the help you need in the newsgroup, I can help you for a
very reasonable fee.
Over 1000 Access users have come to me for help.
Need a month calendar or 7 day calendar? Contact me.
Create A Custom Progress/Status Meter/Bar Chart
You may find a need for creating a "Progress Meter" on your Form, separate
from the status bar progress meter which is callable by using the sysCmd
function in Access. A Progress meter can be created by using two label
controls, directly on top of one another in the form. Here's how you do it:
1. Create a label control, with a sunken style, (we'll call this lblbase)
and make it's backcolor transparent, and forecolor to black.
2. Create a label control, of 0.00 width, identical in height to the baselbl
(we'll call this lblmeter); align the lblmeter exactly with the left edge of
the lblbase control, and send it to the back (i.e. behind the lblbase.) Make
its edges transparent.
3. To update the progress meter place the following code in the form's
module and send it the current and total amounts to measure progress as
appropriate (you can use a timer event or place the calls in looping code
etc.):
Sub updatemtr (currentamt, totalamount)
' This function changes the color based on progress.
' You set the back color of lblmeter to be a single color if desired.
Dim MtrPercent as Single
MtrPercent = currentamt/totalamount
Me!lblbase.Caption = Int(MtrPercent*100) & "%"
Me!lblmeter.Width = CLng(Me!lblbase.Width * MtrPercent)
Select Case MtrPercent
Case Is < .33
Me!lblmeter.BackColor = 255 'red
Case Is < .66
Me!lblmeter.BackColor = 65535 'yellow
Case Else
Me!lblmeter.BackColor = 65280 'green
End Select
End Sub4. Note this same tip can also be used to create a simple horizontal
bar chart on a report, and is especially handy if you don't know what the
total amount might be before you run the report. (The total amount would be
required to be known a priori if you were to use MS Graph to create the
chart, because you would have to set the scale when creating the chart; with
this method, you don't have to know the total amount before the report is
run.)