Continuous Form Case Formatting Odd Results

detrie

Registered User.
Local time
Today, 15:11
Joined
Feb 9, 2006
Messages
113
Access 2003

I am working with two controls
- tblStatusStep (integer)
- ctlCustomerName (string)

I am trying to get the background color of ctlCustomerName to change based on the value of tblStatusStep

0 to 10 = Yellow
11 to 20 = Orange
21 to 30 = Green
31 to 40 = Blue
41 to 50 = Violet
All else = Red

I'm getting:
99 = Orange
Everything else = Yellow

I have this behind the OnCurrent event of my continuous form. Is this the right place? I've also tried OnLoad with the same results

Code:
Private Sub Form_Current()
Dim intStatus As Integer
intStatus = Me.tblStatusStep

Select Case intStatus
'YELLOW
Case 0 To 10
Me.ctlCustomerName.BackColor = rgb(255, 255, 0)
'
'ORANGE
Case 11 To 20
Me.ctlCustomerName.BackColor = rgb(255, 204, 0)
'
'GREEN
Case 21 To 30
Me.ctlCustomerName.BackColor = rgb(153, 204, 0)
'
'BLUE
Case 31 To 40
Me.ctlCustomerName.BackColor = rgb(86, 118, 157)
'
'Violet
Case 41 To 50
Me.ctlCustomerName.BackColor = rgb(165, 104, 206)
'
Case Else
Me.ctlCustomerName.BackColor = rgb(255, 0, 0)
'
End Select
End Sub
 

Users who are viewing this thread

Back
Top Bottom