here's a revised function that will do the trick:
Public Function isOptionBackColor(Optional ByVal str As String, _
Optional ByVal lngSelected As Long, _
Optional ByVal lngNotSelected As Long, _
Optional ByVal blnTransparent = False)
Dim ctlObj As Control
Const lngSel As Long = 12713983 ' light yellow
Const lngNotSel As Long = 16777215 ' white
If lngSelected = 0 Then lngSelected = lngSel
If lngNotSelected = 0 Then lngNotSelected = lngNotSel
With Screen.ActiveControl
For Each ctlObj In .Controls
If TypeOf ctlObj Is Label And Not (ctlObj.Name = str) Then
If ctlObj.Parent.OptionValue = .Value Then
ctlObj.BackColor = lngSelected
ctlObj.BackStyle = 1
Else
If blnTransparent Then ctlObj.BackStyle = 0
ctlObj.BackColor = lngNotSelected
End If
End If
Next
End With
End Function
you can set "default" backcolors, by changing the value of the constants
lngSel and lngNotSel. then you can override one, or both, default colors by
providing one or both of the optional arguments in the function call. the
caveat is this: if you call the function *directly from the Event line in
the Properties box*, you have to provide all three arguments, or none. for
instance, if you do not have an option group label, and you want to override
only the "not selected" default color, you have to enter a "dummy" label
name (or a zero-length string, as ""), and enter the default "selected"
color, as well as the override "not selected" color, as
=isOptionBackColor("x",12713983,14680031)
however, if you call the function from within the AfterUpdate event
procedure, you can skip unneeded arguments, as
Private Sub optNatureAndExtentGroup_AfterUpdate()
isOptionBackColor , , 14680031
End Sub
and for those folks who, like me, prefer to have their labels' BackStyle
transparent, i went whole-hog and added an optional argument for "not
selected" labels to be transparent to the form background, while "selected"
labels show either the default backcolor or replacement backcolor.
hth