R
Richard John
I've got a conditional formatting problem in Access 2000. I simply want to
colour any value outside a given range red and the rest green.
Function percentOfYtdTarget(YTDActual As Double, YTDTarget As Double) As
Variant
Dim tmp
tmp = (YTDActual / YTDTarget)
If tmp < 0.95 And tmp > 1.05 Then
percentOfYtdTarget = Format(tmp, "0.0% [Red]")
Else
percentOfYtdTarget = Format(tmp, "0.0% [green]")
End If
End Function
Why doesn't this work?
I expect to give the user the option of selecting the ranges via a form,
later on. I've temporarily hard coded the values for now, for testing
purposes.
I currently set the formatting using the Access Interface (Tools/Conditional
Formatting). But this is unsatisfactory for my requirements. The same rules
apply to several reports so if the rules change it will be a pain to have do
it manually for each report. So I need to change it via a VBA function call.
Trouble is, I've tried some solutions but I can't get any to work. Nowhere
can I find any solutions on line .. MS$ site, Reference books... nothing
Thanks in Anticipation..
colour any value outside a given range red and the rest green.
Function percentOfYtdTarget(YTDActual As Double, YTDTarget As Double) As
Variant
Dim tmp
tmp = (YTDActual / YTDTarget)
If tmp < 0.95 And tmp > 1.05 Then
percentOfYtdTarget = Format(tmp, "0.0% [Red]")
Else
percentOfYtdTarget = Format(tmp, "0.0% [green]")
End If
End Function
Why doesn't this work?
I expect to give the user the option of selecting the ranges via a form,
later on. I've temporarily hard coded the values for now, for testing
purposes.
I currently set the formatting using the Access Interface (Tools/Conditional
Formatting). But this is unsatisfactory for my requirements. The same rules
apply to several reports so if the rules change it will be a pain to have do
it manually for each report. So I need to change it via a VBA function call.
Trouble is, I've tried some solutions but I can't get any to work. Nowhere
can I find any solutions on line .. MS$ site, Reference books... nothing
Thanks in Anticipation..