Table of contents
TOC
Collapse the table of content
Expand the table of content

OptionGroup.Undo Method (Access)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

You can use the Undo method to reset a control or form when its value has been changed.

Syntax

expression. Undo

expression A variable that represents an OptionGroup object.

Remarks

For example, you can use the Undo method to clear a change to a record that contains an invalid entry.

If the Undo method is applied to a form, all changes to the current record are lost. If the Undo method is applied to a control, only the control itself is affected.

This method must be applied before the form or control is updated. You may want to include this method in a form's BeforeUpdate event or in a control's Change event.

The Undo method offers an alternative to using the SendKeys statement to send the value of the ESC key in an event procedure.

Example

The following example shows how you can use the Undo method within a control's Change event procedure to force a field named LastName to reset to its original value, if it changed.

Private Sub LastName_Change() 
 Me!LastName.Undo 
End Sub

The next example uses the Undo method to reset all changes to a form before the form is updated.

Private Sub Form_BeforeUpdate(Cancel As Integer) 
 Me.Undo 
End Sub

See also

Concepts

OptionGroup Object

© 2017 Microsoft