I have an option group on my form and when I click on an radio button in the
option group I want its label to change yellow. How can I do this?
Here is an example for a 4 button OptionGroup.
Code the Option Group's AfterUpdate event:
If Me.Frame277 = 1 Then
Me.Label281.BackColor = vbYellow
Me.Label283.BackColor = vbWhite
Me.Label285.BackColor = vbWhite
Me.Label290.BackColor = vbWhite
ElseIf Me.Frame277 = 2 Then
Me.Label281.BackColor = vbWhite
Me.Label283.BackColor = vbYellow
Me.Label285.BackColor = vbWhite
Me.Label290.BackColor = vbWhite
ElseIf Me.Frame277 = 3 Then
Me.Label281.BackColor = vbWhite
Me.Label283.BackColor = vbWhite
Me.Label285.BackColor = vbYellow
Me.Label290.BackColor = vbWhite
ElseIf Me.Frame277 = 4 Then
Me.Label281.BackColor = vbWhite
Me.Label283.BackColor = vbWhite
Me.Label285.BackColor = vbWhite
Me.Label290.BackColor = vbYellow
End If
Change the OptionGroup's name (Frame277) as well as the name of the
labels within the group as needed. Make sure each label's BackStyle
property is set to Normal.