Cancel

Mik3

Registered User.
Local time
Today, 10:06
Joined
Jul 10, 2003
Messages
60
Hi,
I got a problem with the cancel button in my form.
I made a macro which sets all values to Null and then close the form. However, an unwanted blank field is created in the table each time the users opens the form and closes it using the cancel button.
Any ideas?
 
In the OnClick Event of your button...
Code:
Private Sub YourButton_Click()

DoCmd.RunCommand acCmdUndo
DoCmd.Close

End Sub

IMO
 
Code:
Private Sub cmdCancel_Click()

    With Me
        .Undo
        DoCmd.Close acForm, .Name
    End With

End Sub
 
Private Sub cmdCancel_Click()
If Me.Dirty Then
Me.Undo
DoCmd.Close acForm, Me.Name
Else
MsgBox"There is nothing to undo"
DoCmd.Close acForm, Me.Name
End If

End Sub
 

Users who are viewing this thread

Back
Top Bottom