M
mcdonaldsemc
Is it possible to have a meter chart "graphong" the value for each
individual record in an Access form or report. My previous attempts
have failed. Using a modification of the following snippet seems like
it would work but I dont know how to reference the value foreach
record. The control always shows the value for the first/top record
in the form/datasheet. Any help would be appreciated!
Heres the basis of what ive been testing (posted elsewhere):
1. Create a Label control, with a sunken style, (we'll call this
baselbl)
and make it transparent in colour.
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 baselbl control, and send it to the back (i.e. behind
the
baselbl.) Make its edges transparent.
3. To update the Progress Meter place the following code in a module
in
the form and send it the current and total amounts to measure as
appropriate:
Sub updatemtr (currentamt, totalamount)
Dim MtrPercent as Single
MtrPercent = currentamt/totalamount
Me!baselbl.Caption = Int(MtrPercent*100) & "%"
Me!lblmeter.Width = CLng(Me!baselbl.Width * MtrPercent)
Select Case MrtPercent
Case Is < .15
Me!lblmeter.BackColor = 255
Case Is < .50
Me!lblmeter.BackColor = 65535
Case Else
Me!lblmeter.BackColor = 65280
End Select
End Sub
4. Note this same tip can also be used to create a simple horizontal
bar chart
on a report
individual record in an Access form or report. My previous attempts
have failed. Using a modification of the following snippet seems like
it would work but I dont know how to reference the value foreach
record. The control always shows the value for the first/top record
in the form/datasheet. Any help would be appreciated!
Heres the basis of what ive been testing (posted elsewhere):
1. Create a Label control, with a sunken style, (we'll call this
baselbl)
and make it transparent in colour.
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 baselbl control, and send it to the back (i.e. behind
the
baselbl.) Make its edges transparent.
3. To update the Progress Meter place the following code in a module
in
the form and send it the current and total amounts to measure as
appropriate:
Sub updatemtr (currentamt, totalamount)
Dim MtrPercent as Single
MtrPercent = currentamt/totalamount
Me!baselbl.Caption = Int(MtrPercent*100) & "%"
Me!lblmeter.Width = CLng(Me!baselbl.Width * MtrPercent)
Select Case MrtPercent
Case Is < .15
Me!lblmeter.BackColor = 255
Case Is < .50
Me!lblmeter.BackColor = 65535
Case Else
Me!lblmeter.BackColor = 65280
End Select
End Sub
4. Note this same tip can also be used to create a simple horizontal
bar chart
on a report