ComboBox.OnUndo 屬性 (Access)ComboBox.OnUndo property (Access)

會傳回或設定指出哪些巨集、 事件程序或使用者定義的函數執行**Undo** 事件發生時的字串Returns or sets a String indicating which macro, event procedure, or user-defined function runs when the Undo event occurs. 可讀寫。Read/write.

語法Syntax

運算式OnUndoexpression.OnUndo

_運算式_代表**ComboBox** 物件的變數。expression A variable that represents a ComboBox object.

註解Remarks

此屬性是很有用的以程式設計方式變更時觸發事件,Microsoft Access 所採取的動作。This property is helpful for programmatically changing the action that Microsoft Access takes when an event is triggered. 例如,在各個事件呼叫之間,您也許想要根據不同狀況下所引動的事件,來改變運算式的參數,或是從事件程序轉換到運算式或是巨集。For example, between event calls you may want to change an expression's parameters, or switch from an event procedure to an expression or macro, depending on the circumstances under which the event was triggered.

此屬性的有效值為:Valid values for this property are:

  • 巨集名稱,其中_macroname_是巨集的名稱。macroname, where macroname is the name of a macro.

  • [事件程序],這表示與指定之物件的Undo事件相關聯的事件程序。[Event Procedure], which indicates the event procedure associated with the Undo event for the specified object.

  • =functionname(),其中_functionname_是使用者定義函數的名稱。=functionname(), where functionname is the name of a user-defined function.

範例Example

下列範例指定當 Undo 事件發生於目前專案的第一個表單上,應該執行的關聯的事件程序。The following example specifies that when the Undo event occurs on the first form of the current project, the associated event procedure should run.

Forms(0).OnUndo = "[Event Procedure]"

下列範例指定當 Undo 事件發生於目前專案的第一個表單上任何文字方塊中,應執行的關聯的事件程序。The following example specifies that when the Undo event occurs in any text box on the first form of the current project, the associated event procedure should run.

Dim ctlLoop As Control 
 
For Each ctlLoop In Forms(0).Controls 
 If ctlLoop.Type = acTextBox Then 
 ctlLoop.OnUndo = "[Event Procedure]" 
 End If 
Next ctlLoop 

支援和意見反應Support and feedback

有關於 Office VBA 或這份文件的問題或意見反應嗎?Have questions or feedback about Office VBA or this documentation? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.