Delete Record and Close Form

Novice1

Registered User.
Local time
Today, 10:12
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.
 
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.
 
Me.Undo
DoCmd. CloseForm, acForm, Me.Name
 
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

Back
Top Bottom