Conditional formatting in VBA

ianclegg

Registered User.
Local time
Today, 08:14
Joined
Jul 14, 2001
Messages
58
Can anyone help

I need to change the background colour of a field in a report dependant on it's value

my code is a s follows and it is placed in the detail section in the on format event

if togo.value < 10 then

togo.backcolor=255 (Red)

end if

I can make all the records togo foreground colors = 255

and that works , but not for all records less than 10 and not the background color


I am using access 2003 on an XP machine


Thanks in anticipation


Regards

Ian Clegg
 
Is there a reason why you can't use regular conditional formatting? You select the control, go to FORMAT > CONDITIONAL FORMATTING and set the ValueIS property to

<10

and then set the background color you want when it matches. No coding necessary.
 
Hi

I never thought of that, I have never used it before.

However I have set the values to

field value is less than or equal to 10


set the back colour to red and bold letters

It still does not work

Am I missing something.


Ian
 
Hi

I never thought of that, I have never used it before.

However I have set the values to

field value is less than or equal to 10


set the back colour to red and bold letters

It still does not work

Am I missing something.


Ian
You might be missing something. Can you post a screenshot of your Report in design view and then also a screenshot of your conditional format window where you have the formula?
 
That was it, leftovers from the trying with the detail section conditional formating

Thanks again for all your help

Regards

Ian
 
Cool, thanks for posting back with your success. Well wishes for continued success with your project. :)
 

Users who are viewing this thread

Back
Top Bottom