It should be something along these lines, assuming the option button control
is ctlOption and the combo control is ctlCombo...
Because you want to check this when either of the two controls is changed, I
would make a private function that you call from the AfterUpdate of each
control. The function will evaluate the values of each control, and return
true if it meets your spec, in which case we'll go to another function that
will change the values to what you want them to. (these functions will keep
us from running duplicate code in the AfterUpdate event of the two controls).
Private Sub ctlOption_AfterUpdate()
If pfCheckValues = True Then
Call psChangeValues
End If
End Sub
Private Sub ctlCombo_AfterUpdate()
If pfCheckValues = True Then
Call psChangeValues
End If
End Sub
Private Function pfCheckValues() As Boolean
If (Me.ctlOption = ??) And (Me.ctlCombo = ??) Then
pfCheckValues = True
Else
pfCheckValues = False
End If
End Function
Private Sub psChangeValues()
Dim i as Integer
i = MsgBox "Do you want to change values?", vbYesNo
'6 is the return for clicking Yes
If i = 6 Then
Me.ctlOption = ??
Me.ctlCombo = ??
End If
End Sub
Replace any ?? with the values you want to check/replace. Be sure to use
quotes if it is a string, or leave them out if it's a number. Ex:
Me.ctlOption = 2
Me.ctlCombo = "ThisValue"
Change the control names to those in your form, and this should get you on
the right track.
hth
--
Jack Leach
www.tristatemachine.com
"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)