changing properties of a control according to the value

  • Thread starter Thread starter virum
  • Start date Start date
V

virum

Guest
Hi everybody: I have numerical field, back color is white. I would like it to change to red (OnExit) when the value is >100
Anybody can help ?
Many thanks in advance
V.
 
Hi,

Put the following code in the Exit event of the control in question (and replace 'text0' with the name of your control):

If [Text0] > 100 Then
Text0.BackColor = vbRed
Else
Text0.BackColor = vbWhite
End If


That will do the trick for you.

Andy
 
Thanx !

Dear Andy: It works just fine.
Thank very very much.

V.
 
ooops... a new problem...

Dear Andy et al: I was too quick to celebrate ! The color changes according to the value, but:
Red color remains in all the other records, even if the value is in the range of the white color !
I guess that my question was wrong from the beginning when I asked about "OnExit".
I tried to write the same line on different "On..." without success. I suppose it is a general property but I cannot figure out where to add it.
Thank you again for your help
V.
 
Put the code in the FormCurrent event, in the AfterUpdate event procedure of your textbox add the line Form_Current
 

Users who are viewing this thread

Back
Top Bottom