Hi
I am trying to create a module that changes the combo box back colour based on the value.
I have it working using if statements but there is 15 combo box so I just want a module I can reference.
This is what I have so far but it isn't working:
Public Sub ChangeColour(cboControl As ComboBox)
Dim col As Long
Select Case Nz(cboControl.Value, "")
Case "Amber"
col = RGB(237, 135, 45)
Case "Green"
col = RGB(0, 255, 0)
Case Is = "Red"
col = RGB(255, 0, 0)
Case Else
col = RGB(255, 255, 255)
End Select
cboControl.BackColor = col
End Sub
Private Sub cboCorrectGreeting_AfterUpdate()
Me.ChangeColour (Me.cboCorrectGreeting)
End Sub
Can anyone point out where I am going wrong?
Thanks
Carl
I am trying to create a module that changes the combo box back colour based on the value.
I have it working using if statements but there is 15 combo box so I just want a module I can reference.
This is what I have so far but it isn't working:
Public Sub ChangeColour(cboControl As ComboBox)
Dim col As Long
Select Case Nz(cboControl.Value, "")
Case "Amber"
col = RGB(237, 135, 45)
Case "Green"
col = RGB(0, 255, 0)
Case Is = "Red"
col = RGB(255, 0, 0)
Case Else
col = RGB(255, 255, 255)
End Select
cboControl.BackColor = col
End Sub
Private Sub cboCorrectGreeting_AfterUpdate()
Me.ChangeColour (Me.cboCorrectGreeting)
End Sub
Can anyone point out where I am going wrong?
Thanks
Carl