View Full Version : Changing Text Colour in Report


Brad
06-29-2005, 07:24 PM
I have a report and in the report I add two cells togeather. I want to make the result chnage to red if negative and stay black if positive, any ideas on how I do this ?

Cheers,

andrew93
06-30-2005, 12:22 AM
Hi Brad
While in your report design, click the field in question and on your menu click Format -> Conditional Formatting -> the rest should be easy.
Andrew :)

Brad
07-03-2005, 05:50 PM
Hi Andrew,
You would think so but ... this is access 97 and there is no conditional format option in teh format menu, any other ideas ?

andrew93
07-03-2005, 10:18 PM
Ah yes - that piece of information might have been useful a few days ago ... ;)

Anyway, in your report design, select the field in question, and try something like this for the format :

$#,##0.00 ; [Red]-$#,##0.00

Or
0.00 ; [Red]-0.00
if you don't want the $ sign

Or
0 ; [Red] -0
if you don't want decimals, or any other combination of symbols and decimals.

Please note I haven't tested these given I have got A97 on this PC.

HTH, Andrew

alastair69
07-04-2005, 04:02 AM
This code come condition also works in form view in stead of useing currency you can use the following: Format: £#,##0.00 ; [Red]-£#,##0.00, thank you to others for sharing there knoledge :D

Alastair

gagro
07-05-2005, 04:50 AM
in a code in Detail write this code.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If name < 0 Then
name.ForeColor = 255
Else
name.ForeColor = 0
End If
End Sub

name is the name of Your Text Box in report
255 is for red colour, 0 is for black

I hope it will do it

DanG
07-05-2005, 02:50 PM
I have A97 and have just done it the VBA way...
This is a cool trick..I did notice that when you use the 0.00 ; [Red]-0.00 or any variation of this method, it off sets the alignment on the negitive values which is real strange.
Not a big deal but can limit the use in some reports/forms.

Brad
07-05-2005, 03:33 PM
Cheers that worked a treat.. Yeah I forget about version info .. will make sure I include it next time .

Thanks heaps for your help, it is often the simpl things that make all the difference.

Rich
07-06-2005, 12:16 AM
I have A97 and have just done it the VBA way...
This is a cool trick..I did notice that when you use the 0.00 ; [Red]-0.00 or any variation of this method, it off sets the alignment on the negitive values which is real strange.
Not a big deal but can limit the use in some reports/forms.
It doesn't on mine, at least not with currency values