Cancel (1 Viewer)

Mik3

Registered User.
Local time
Today, 02:23
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?
 

IMO

Now Known as ___
Local time
Today, 02:23
Joined
Sep 11, 2002
Messages
723
In the OnClick Event of your button...
Code:
Private Sub YourButton_Click()

DoCmd.RunCommand acCmdUndo
DoCmd.Close

End Sub

IMO
 

Mile-O

Back once again...
Local time
Today, 02:23
Joined
Dec 10, 2002
Messages
11,316
Code:
Private Sub cmdCancel_Click()

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

End Sub
 
R

Rich

Guest
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
 

Mik3

Registered User.
Local time
Today, 02:23
Joined
Jul 10, 2003
Messages
60
Problem solved.
Thanks all :)
 

Users who are viewing this thread

Top Bottom