Change Forecolor

  • Thread starter Thread starter racingdoc
  • Start date Start date
R

racingdoc

Guest
I have a basic question
I want to change the forecolor of a text box when another text box or possibly a Yes No box is true.
Can you tel me the correct way to code this.
 
from the event of the other box you would use something like:-
Me.MyField.ForeColor = vbRed

HTH

Peter
 
Forecolor change

Thanks Peter for such a quick reply I will try this
 
More precisely, you need a couple of things to do this right and flashy at the same time:

1. A general routine - which could still be in the form's class module if you wanted it to be that way - to test the values of the controls that govern the change. (Public or Private or unqualified Sub). You set the .ForeColor to vbRed or vbBlack or vbBlue or vbGreen or ... as you need, based on tests of the other thing's .Value property. As the last part of the routine, include statement

Me.Refresh

2. Call this routine in your form's OnCurrent routine

3. Call this routine in the AfterUpdate event of any field that contributes to the computation of the selected colors.

That will not only keep the colors correct but it will do it when you change the values of related fields without waiting for a record change or a timed auto-refresh.
 

Users who are viewing this thread

Back
Top Bottom