tags:

views:

701

answers:

2

I have some code that displays values from a record set. If the value is less than 8000, I wish to change the color of the displayed text. I tried this:

If (recordset(1).Value) < 80000 Then
    font.color = &HFFEFEF
End If

But it didn't work. How do I do it?

+2  A: 

You don't specify how you are displaying the information, but if you're using a TextBox, you would changed the text color via the ForeColor property

Text1.ForeColor = &HFFEFEF
raven
Thanks, Now Working correctly
Gopal
+2  A: 

Addon to raven's answer.

You can also use:

Text1.ForeColor = vbBlack

'vbBlack, vbWhite, vbBlue, vbRed, vbGreen, vbYellow, vbMagenta, vbCyan

and

Text1.ForeColor = RGB(255, 0, 0 ) 'red

0, 0, 0 - black
255, 255, 255 - white
255, 0, 0 - red
0, 255, 0 - green
0, 0, 255 - blue
255, 255, 0 - yellow
0, 255, 255 - cyan
255, 0, 255 - magenta
Secko