Cancel changes

E

Erwin Bormans

Hi all

I've got the following problem and after 2 days of trying to solve it, it
still stays the same...

I've got a form that loads 1 record out of a table to edit.

The controls on the form are linked with the table.

At the end of the form I've got 2 buttons: Save and Cancel.

But if you change something and you click Cancel he still saves the changes
in the table.

I tried to find some code that cancels the saving and I tried to copy that
record in a new recordset and than reload the temporary recordset when the
user clicks on the cancel button, just before closing the form. But I
doesn't want to work.

Somebody some advise?

Thx in advance

Kind regards
Erwin
 
J

Jeff Boyce

Erwin

We aren't there. We can't see what code your <Cancel> button fires off.
Unfortunately, your description is a bit like "my button doesn't work,
what's wrong?" (<g>)

Please open the form in design view, open the VBA window for that particular
control, copy the code and paste it into a post back here.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
E

Erwin Bormans

Private Sub knp_Cancel_Click()

DoCmd.Close acForm, "frm_Bok_Aanpassen_Detail", acSaveNo

End Sub

Kind regards
Erwin
 
J

Jeff Boyce

Erwin

The code you posted tells Access to close the form and not save any changes
.... to the design of the form!

Another word for what I believe you mean when you say "cancel" is "undo"
(Access-speak for don't accept the data changes). Check Access HELP for
"undo".

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
E

Erwin Bormans

Private Sub knp_Cancel_Click()

Form_frm_Bok_Aanpassen_Detail.Undo
DoCmd.Close acForm, "frm_Bok_Aanpassen_Detail", acSaveNo

End Sub

Thats all to it :)

Thx a miljoen times!!!!

Kind regards
Erwin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top