Code for coloured text

D

Dave Smith

hi, i have a text box that displays the answer to a calculation. i would
like the answer if it is below X value to display Orange in between X & Y
Green & Above Y as Red.

thanks in advance

Dave Smith
 
D

Dave

Depending on which version of Access you're using, you can do this a few ways.
Try looking up 'Conditional Formatting' in help.

Otherwise you'll need to have an event procedure which fires after the
calculation is made to change the forecolor property to the desired colour.

example
if myCalcField between x and y then
me!myCalcField.Forecolor = 26367
else
if myCalcField < x then
me!myCalcField.Forecolor = 32768
else
me!myCalcField.Forecolor = 255
endif
endif

Hope that helps
Dave
 
T

Tom Wickerath

To add a little to Dave's answer, check out an article I wrote on conditional
formatting:

Conditional Formatting
http://www.access.qbuilt.com/html/conditional_formatting.html


Tom
_____________________________________

:

Depending on which version of Access you're using, you can do this a few ways.
Try looking up 'Conditional Formatting' in help.

Otherwise you'll need to have an event procedure which fires after the
calculation is made to change the forecolor property to the desired colour.

example
if myCalcField between x and y then
me!myCalcField.Forecolor = 26367
else
if myCalcField < x then
me!myCalcField.Forecolor = 32768
else
me!myCalcField.Forecolor = 255
endif
endif

Hope that helps
Dave

_____________________________________

:

hi, i have a text box that displays the answer to a calculation. i would
like the answer if it is below X value to display Orange in between X & Y
Green & Above Y as Red.

thanks in advance

Dave Smith
 
Top