Delete Record and Close Form (1 Viewer)

Novice1

Registered User.
Local time
Yesterday, 16:58
Joined
Mar 9, 2004
Messages
385
I have a form a customer completes for service. After collecting the data the customer clicks on one of two buttons.

The first button (Finished) records the time, closes the form and brings me back to the main menu.

The second button (I do NOT want to sign in) was built in the event someone changed their mind and decided they didn't want to sign in. I simply want to disregard the form input and return to the main menu (form). I cannot make it work.

I tried deleting the record but the user has to confirm the deletion and the form doesn't close and open the main menu form even when I write in the cord in an Event Procedure.

I can close the form and open the main menu form but the captured data isn't deleted.

Any help would be appreciated.
 

ReAn

Dangerous Programmer...
Local time
Yesterday, 17:58
Joined
Jun 25, 2004
Messages
250
Around your delete code do this:

Code:
DoCmd.SetWarnings False

{my delete code here}

DoCmd.SetWarnings True

This should clear that delete message.

Then call:

Code:
DoCmd.OpenForm "formtoopen"
DoCmd.Close acForm, "formtoclose", acSaveYes

Just replace the values for the forms and such.
 
R

Rich

Guest
Me.Undo
DoCmd. CloseForm, acForm, Me.Name
 

Accessator

Registered User.
Local time
Today, 09:58
Joined
Aug 22, 2007
Messages
10
Me.Undo
DoCmd. CloseForm, acForm, Me.Name

Uhm... do you mean like this ?

Code:
    If Me.Dirty = True Then
        Me.Undo
        Cancel = True
    End If
    DoCmd.Close acForm, Me.Name
 

ScrmingWhisprs

I <3 Coffee Milk.
Local time
Yesterday, 19:58
Joined
Jun 29, 2006
Messages
156
Nope. You just need to put it in the OnClick event of your button.
Code:
Private Sub YourButton_Click()
Me.Undo
DoCmd.Close acform, Me.Name
End Sub
 

Users who are viewing this thread

Top Bottom