conditional formatting .. negative numbers ?

  Macnova 14:08 03 Feb 05
Locked

Can anybody help?

I'm trying to apply conditional formatting to a report control (Difference) which holds values ranging from 100 to -100. I want to format the control as so:
=> 0 = green
0 and > -10 = yellow
= -10 = red

I have used Conditional formatting in Access 2000 to do this, but it will only respond to the first negative condition and turns all negative numbers orange.

To overcome this, I have turned to VBA and have written some code in the OnFormat event of the controls section

Dim Difference As Single
If Me!Difference >= 0 Then
Me!Difference.ForeColor =vbGreen
ElseIf Me!Difference 0 And Me!Difference >= -10 Then
Me!Difference.ForeColor =vbYellow
EsleIf Me!Difference -10 Then
Me!Difference.ForeColor =vbRed
End If

This brings up the sames results, i.e. all negative numbers are displayed as orange. How do I overcome this and make access recognise more than one conditional format on negative values?

Cheers

  Macnova 14:14 03 Feb 05

Can anybody help?

I'm trying to apply conditional formatting to a report control (Difference) which holds values ranging from 100 to -100. I want to format the control as so:
=> 0 = green
< 0 and > -10 = yellow
=< -10 = red

I have used Conditional formatting in Access 2000 to do this, but it will only respond to the first negative condition and turns all negative numbers orange.

To overcome this, I have turned to VBA and have written some code in the OnFormat event of the controls section

Dim Difference As Single
If Me!Difference >= 0 Then
Me!Difference.ForeColor =vbGreen
ElseIf Me!Difference < 0 And Me!Difference >= -10 Then
Me!Difference.ForeColor =vbYellow
EsleIf Me!Difference < -10 Then
Me!Difference.ForeColor =vbRed
End If

This brings up the sames results, i.e. all negative numbers are displayed as orange. How do I overcome this and make access recognise more than one conditional format on negative values?

Cheers

  118-118 Got Your Number 14:21 03 Feb 05

Dim Difference As Single If Me!Difference >= 0 Then Me!Difference.ForeColor =vbGreen ElseIf Me!Difference 0 And Me!Difference >= -10 Then Me!Difference.ForeColor =vbYellow EsleIf Me!Difference < -10 Then Me!Difference.ForeColor =vbRed End If

Notice that after the line the >= -10 you have left out the < before the next -10.

The way I read the logic is that you are saying if x > and = to -10 then yellow else if x = -10 then red; you have a contradiction here between whether your value should be yellow or red at -10

  Macnova 15:19 03 Feb 05

On my version in the database there is a < before the 10- that must just be a typo.

This thread is now locked and can not be replied to.

How to get Windows 10 for free | How to install Windows 10: There is still a way to avoid paying…

1995-2015: How technology has changed the world in 20 years

Alex Chinneck’s giant ice cube Christmas tree at Kings Cross

Apple rumours & predictions 2017: The iPhone 8, new iPads, and everything else you should expect fr7…