Closing forms without saving

  • Thread starter Thread starter Phil
  • Start date Start date
P

Phil

I have developed a simple database which uses forms to
enter and retrieve data from the tables. On these form I
have placed two command buttons. The first is to save the
data entered and then closes the form. The second is set
to close the form only.This is to be used if the user
wishes to discard the information entered. The operation
of these control buttons is controled through macros
created through event builder.

The problem is that any data that is entered into the from
is saved, regardless of which button is pressed.

Can anyone point me in the right direction?
 
Undo the form before closing.

Here is an example of the Event Procedure you might use in the Click event
of your cancel button:

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