Different Text Color for Different Value

  • Thread starter Thread starter Lee Mathews
  • Start date Start date
L

Lee Mathews

Guest
I am a Access Designer, among other things, I
seem to be having a problem, with changing
text color. In a column, I want to say see if a series of numbers falls within the boundries. Say for example; Low point will
be 2.50 and High point will be 4.00. If the numbers stay within this range I want the color to be black. If these numbers are higher or lower than the established range, I want them to be red, showing as out of spec.
 
In the control source for the text box try this:

= Iif([NumberBox]<[LowPointBox] OR [NumberBox]>[HighPointBox],Format([NumberBox],[Red]),[NumberBox])

Let me know if this helps.
 
Try putting the following in the OnCurrent() Procedure of the form.

If [txtYourText] < 2.50 then
[txtYourText].Forecolor = 255
Elseif [txtYourText] > 4 then
[txtYourText].ForeColor = 255
else
[txtYourText].ForeColor = 0
end if

Please note this will only work if you are using a text box in a continuous form instead of a list box as you cannot control the individual colours of each row/column in a list box, only that of the list box as a whole.

HTH

Mitch.
 
Thank you very much Mitch. It worked.

If there is any help, I can be please do not
hesitate to ask
 

Users who are viewing this thread

Back
Top Bottom