cancel button for form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do you program a cancel button so that the form does not file the
information in the table?
 
Set the button's cancel property to True and then place the following code in
the button's _Click procedure:

Private Sub cmdCancel_Click()
If Me.Dirty Then
Me.Undo
End If
DoCmd.Close acForm, Me.Name

End Sub
 
First, you have a Cancel button preprogrammed for you. The Esc key does this
job. Educate the user that pressing Esc once undoes the current control and
pressing Esc a second time undoes the current record.

That said, the code you need behind a button is

Me.Undo
 
thanks, jason & wayne

Wayne Morgan said:
First, you have a Cancel button preprogrammed for you. The Esc key does this
job. Educate the user that pressing Esc once undoes the current control and
pressing Esc a second time undoes the current record.

That said, the code you need behind a button is

Me.Undo
 
Back
Top