Code for coloured text

  • Thread starter Thread starter Dave Smith
  • Start date Start date
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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top