I have written a case statement in VBA to color code a report. The report is to show expiring contracts. Unfortunately, the CASE statement is not working right, it colors the first, third, and last correctly but not the second.
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
Select Case Me.Line_of_Business.Text
Case ""
Case "Commercial"
Me.GroupHeader0.BackColor = RGB(0, 0, 255)
Case "Government"
Me.GroupHeader0.BackColor = RGB(0, 255, 0)
Case "Infrastructure"
Me.GroupHeader0.BackColor = RGB(255, 0, 0)
Case Else
Me.GroupHeader0.BackColor = RGB(255, 255, 51)
Me.Line_of_Business.ForeColor = RGB(0, 0, 0)
Me.Label29.ForeColor = RGB(0, 0, 0)
Me.Label30.ForeColor = RGB(0, 0, 0)
Me.Label31.ForeColor = RGB(0, 0, 0)
Me.Label32.ForeColor = RGB(0, 0, 0)
Me.Label33.ForeColor = RGB(0, 0, 0)
End Select
End Sub
Any help would be appreciated.
Tim
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
Select Case Me.Line_of_Business.Text
Case ""
Case "Commercial"
Me.GroupHeader0.BackColor = RGB(0, 0, 255)
Case "Government"
Me.GroupHeader0.BackColor = RGB(0, 255, 0)
Case "Infrastructure"
Me.GroupHeader0.BackColor = RGB(255, 0, 0)
Case Else
Me.GroupHeader0.BackColor = RGB(255, 255, 51)
Me.Line_of_Business.ForeColor = RGB(0, 0, 0)
Me.Label29.ForeColor = RGB(0, 0, 0)
Me.Label30.ForeColor = RGB(0, 0, 0)
Me.Label31.ForeColor = RGB(0, 0, 0)
Me.Label32.ForeColor = RGB(0, 0, 0)
Me.Label33.ForeColor = RGB(0, 0, 0)
End Select
End Sub
Any help would be appreciated.
Tim