Changing Background Colour with code

neill_hucklesby

New member
Local time
Today, 08:56
Joined
Sep 19, 2006
Messages
2
Help?

Trying to change the background colour of a text box, depending on its value.

e.g. If Girl show pink, if Blue show Blue.

I have managed to do this with the following code;

If Me!Sex = "f" Then
Me!YP.BackColor = 13408767
Else
Me!YP.BackColor = 16737843
End If

But I can only do this for all the records in the detail section, and not on a record by record basis.

Any ideas?

Neill
 
If only limited choices - and I guess blue and pink unless things have dramatically changed (LOL) - then you would be much better using conditional formatting for the text box since it is dead easy.
HTH
 
I think if you execute this in the OnCurrent event for the form it should work if you are not in ContinousForm mode. If you are then maybe you could do it with Conditional formatting...

???
ken
 
Quick fix

If only limited choices - and I guess blue and pink unless things have dramatically changed (LOL) - then you would be much better using conditional formatting for the text box since it is dead easy.
HTH

Thanks Malcy, quick fix cheers.
 

Users who are viewing this thread

Back
Top Bottom