mraetrudeaujr
Technical User
I have been working with the "After Update" Event Procedure on a particular control. I've got it worked out to where my "IF" statements are doing what I need them to do, with one exception...the one where I want to BackGround to change color, doesn't. Here is my code:
As you can see, my first statement changes an option group's value based on what country is selected; the second, I want the BackGround color to change to RED based on the first statement (of course); and the last statment changes another option group value based on the country selection. What went wrong with my code? The first and last statements work as coded, but the second doesn't change the background color. I have tried both the number-codes for the colors and the VB coding (vbRed and VbBlue). The vbBlue is for testing purposes, but I would rather have it be the default 'grey' background color. I first need to iron out why my IF statement isn't working. Suggestions? Code?
Code:
Private Sub cboCountryPage2_AfterUpdate()
If Me.cboCountryPage2.Column(3) = 1 Then
Me.optgrpSIRCountryPage2.Value = 1
Else
Me.optgrpSIRCountryPage2.Value = 2
End If
If Me.cboCountryPage2.Column(3) = 1 Then
Me.optgrpSIRCountryPage2.BackColor = vbRed
Else
Me.optgrpSIRCountryPage2.BackColor = vbBlue
End If
If Me.cboCountryPage2.Column(4) = 1 Then
Me.optgrpOTMpage4.Value = 1
Else
Me.optgrpOTMpage4.Value = 2
End If
End Sub
As you can see, my first statement changes an option group's value based on what country is selected; the second, I want the BackGround color to change to RED based on the first statement (of course); and the last statment changes another option group value based on the country selection. What went wrong with my code? The first and last statements work as coded, but the second doesn't change the background color. I have tried both the number-codes for the colors and the VB coding (vbRed and VbBlue). The vbBlue is for testing purposes, but I would rather have it be the default 'grey' background color. I first need to iron out why my IF statement isn't working. Suggestions? Code?