Conditional Formatting - backcolor not working

branston

Registered User.
Local time
Today, 20:16
Joined
Apr 29, 2009
Messages
372
hi, I have the following code:

If Me.Urgency = 3 Then 'Red
Me.Urgency.ForeColor = RGB(255, 0, 0)
Me.Urgency.BackColor = RGB(255, 0, 0)
Else
If Me.Urgency = 2 Then 'Orange
Me.Urgency.BackColor = RGB(255, 102, 0)
Me.Urgency.ForeColor = RGB(255, 102, 0)
Else
If Me.Urgency = 1 Then 'Green
Me.Urgency.BackColor = RGB(0, 255, 0)
Me.Urgency.ForeColor = RGB(0, 255, 0)
Else
Me.Urgency.ForeColor = RGB(255, 255, 255)
End If
End If
End If

The ForeColor comand works fine, but it seems to be ignoring the BackColor part. Have i got something wrong somewhere?
Any help would be greatly appreciated.

Thank you!
 
You are going to want to use either a Select Case structure or ElseIf instead of all but the last Else.
 
Ok, thanks for your input RG. I tried using elseIf, but i still get the same problem. I think the same will happen with the select case structure (although ill try it in a sec). The thing is, I know the if statment is working beacuse the forecolor changes as its meant to, its just not doing the backcolor as well.
 
Ahha! Figured it out - i knew it would be something simple... In the properties of the box, the back style was set to transparent. Changed it to normal and it works fine. Thanks!
 
That's great! Thanks for posting back with your success.
 

Users who are viewing this thread

Back
Top Bottom