Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Formatting continuous form using VBA

Status
Not open for further replies.

oxicottin

Programmer
Jun 20, 2008
353
US
Hello, I have a continuous form that has 31 Text boxes in a row and they are named Text1, Text2, Text3 and so on and when the form is opened the 31 Text boxes are now 372 (31 horizontal x 12 vertical). I tried to use conditional formatting but it only lets you use 3 formulas. What I’m trying to do is I have 17 different letters ( X, P, V, XH, H, EA, UA, ET, UT, LE, DL, ML, FL, PL, J, F, PC ) and each letter has its own color and if I type the letter “P” in one of the 372 text boxes I would like that box to turn blue or if I type a letter “V” in one of the text boxes I would like it to turn green and so on for the 17 different letters and if I type nothing then the color stays white. How can I accomplish this?

Thanks,
Chad
 
Hi,

Why not use case statement instead? or if and else statement...


if textbox1 = x then
textbox1.backcolor = red
else if textbox2 = p then

textbox2.backcolor = green

etc

Not sure but you can put it in the after update event?

hope this helps
 
Thanks hsingh1981! I saw that sight... I cant use the if and else statement because it changes the entire row. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top