Cancel Change In Option Group

C

Corrine

Is there a way to cancel a change in an option group? The option group still
changes to the option clicked on when clicking on the NO button with the
following code in the BeforeUpdate event of the option group.

If MsgBox("Change?", vbYesNo) = vbNo Then
Cancel = True
Me!MyOptionGroupName.Undo
End If

I also tried reversing the Cancel and Undo lines.

Thanks!

Corrine
 
R

rkc

Corrine said:
Is there a way to cancel a change in an option group? The option group still
changes to the option clicked on when clicking on the NO button with the
following code in the BeforeUpdate event of the option group.

If MsgBox("Change?", vbYesNo) = vbNo Then
Cancel = True
Me!MyOptionGroupName.Undo
End If

I also tried reversing the Cancel and Undo lines.

Interesting. We are probably both missing something here, but the
following code shows the only way I can make this work:

'Form level private variable
private optionValue

Private Sub Frame6_Click()

If MsgBox("Change?", vbYesNo) = vbNo Then
Me!Frame6.Value = OptionValue
End If
optionValue = Me.Frame6.Value

End Sub

You would think you could use the Frame6.OldValue property
instead of a form level variable, but it's value is changed by the
time the frame's BeforeUpdate event fires.
 
Top