Table of contents
TOC
折叠目录
展开目录

ComboBox.Undo 方法 (访问)ComboBox.Undo Method (Access)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

您可以使用Undo方法重置控件或窗体时其值已更改。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 a ComboBox object.

注解Remarks

例如,可以使用Undo方法来清除对某个包含无效输入的记录的更改。For example, you can use the Undo method to clear a change to a record that contains an invalid entry.

如果将Undo方法应用于窗体,对当前记录的所有更改都都将丢失。如果将Undo方法应用于控件,该控件本身受到影响。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.

Undo方法提供替代使用SendKeys语句的事件过程中发送的 ESC 键的值。The Undo method offers an alternative to using the SendKeys statement to send the value of the ESC key in an event procedure.

示例Example

下面的示例演示如何使用控件的Change事件过程中的撤消方法来强制一个名为姓氏重置为其原始值,如果更改字段。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

下一示例使用Undo方法重置到窗体的所有更改,然后更新该窗体。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

组合框对象ComboBox Object

© 2018 Microsoft