QBColor
(1)
Report
(1)
FormatCount
(1)
OnFormat
(1)
Day
(1)

Display different colors on the same text box?

Asked By Megaton
20-Nov-09 09:56 PM
This may sound crazy. If I want to display red for negative numbers and
yellow for positive numbers on the same text box on a report, is it possible?

Thanks

Megaton,Use the OnFormat event for the report section where your control

Al Campagna replied to Megaton
20-Nov-09 10:12 PM
Megaton,
Use the OnFormat event for the report section where your control is
located.
Let's say it is in the Detail section, and the control is named Balance.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Balance < 0 Then
Me.Balance.Forecolor =  QBColor(12) 'lt red
ElseIf Balance = 0 Then
Me.Balance.Forecolor =  QBColor(0)  'black
ElseIf Balance > 0 Then
Me.Balance.Forecolor =  QBColor(14)  'lt yellow
End if
End Sub

You did not indicate what color 0 was, so I included it...
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

Set the control's Format property to:Change [Blue] to whatever color you wish

fredg replied to Megaton
21-Nov-09 12:30 AM
Set the control's Format property to:

Change [Blue] to whatever color you wish 0 values to display in.


--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Brilliant! Thanks a lot."Al Campagna" wrote:

Megaton replied to Al Campagna
21-Nov-09 01:24 AM
Brilliant! Thanks a lot.
This works too, although it indent numbers a bit.Thanks a lot"fredg" wrote:
Megaton replied to fredg
21-Nov-09 01:59 AM
This works too, although it indent numbers a bit.
Thanks a lot
Post Question To EggHeadCafe