I'm having no luck writing a Cancel button for a subform. The cancel will undo changes for the main form, but won't do anything for the subform. Setting the focus to the subform and then .undo results in the BeforedelConfirm event being called!! So I thought I'd try this (from the Help). But ctl causes a problem. When I change it to ctlTextBox the .OldValue is the same as the .Value! The help talks about writing your own Undo, but how?!
Sub btnUndo_Click()
Dim ctlTextbox As Control
For Each ctlTextbox in Me.Controls
If ctlTextbox.ControlType = acTextBox Then
ctlTextbox.Value = ctl.OldValue
End If
Next ctlTextbox
End Sub
Sub btnUndo_Click()
Dim ctlTextbox As Control
For Each ctlTextbox in Me.Controls
If ctlTextbox.ControlType = acTextBox Then
ctlTextbox.Value = ctl.OldValue
End If
Next ctlTextbox
End Sub