kgt169
10-26-2001, 05:08 AM
Hello,
Ive been learning to use access so far from the help file alone, I have my database all set up, but I need to add cancle without saving buttons to my forms I followed the instructions exactly (in the help files) but the button closes the form and saves the changes to the table. I Did set the macro to no save but it doesnt work. Am i missing something?
Thanks for any help in advance
SteveA
10-26-2001, 08:47 AM
The Save option that you are setting for the Close action is checking to see if the layout of the form has been changed, not if the record has been changed.
A quick solution is to add an extra line to your cancel macro before the Close action as follows:
Action: RunCommand
Command: Undo
This command undoes any changes the user has made to the current record.
A couple of things to keep in mind is that Access automatically saves changes made to a record whenever you close a form, move from one record to another within a form or choose save record from the Records menu.
If you need any further information, please let me know.
Cheers,
SteveA
Uvuriel03
07-02-2008, 09:39 AM
I have a button like this, but when I click "Cancel", I get an error message.
The command or action 'Undo' isn't available now.I'm pretty sure this is because nothing has been changed, so nothing can be undone. Is there a condition I could add before the "Runcommand" condition so that it only runs "Undo" if something has been changed?
Mike Vytal
07-02-2008, 06:15 PM
Hello,
Ive been learning to use access so far from the help file alone, I have my database all set up, but I need to add cancle without saving buttons to my forms I followed the instructions exactly (in the help files) but the button closes the form and saves the changes to the table. I Did set the macro to no save but it doesnt work. Am i missing something?
Thanks for any help in advance
Just create the button....then with the wizard, choose "Record Operations", then choose "Undo Record".
Keep in mind, this button only applies to the current record. Like Steve said, once you or your users advance to the next record or close the form, the record is automatically saved. Hope this helps.
boblarson
07-02-2008, 10:38 PM
You can test first if there is anything to undo by using
If Me.Dirty Then
Me.Undo
End If
basayel
08-29-2008, 08:07 AM
I have a button like this, but when I click "Cancel", I get an error message.
I'm pretty sure this is because nothing has been changed, so nothing can be undone. Is there a condition I could add before the "Runcommand" condition so that it only runs "Undo" if something has been changed?
I was having the same problem as yours ..just type a condition >> [Forms]![Your Form Name].[Dirty]=-1...besides the RunCommand action and it will quit without this error message...Hope it helps :)
Uvuriel03
08-29-2008, 08:14 AM
*chuckle* Thanks! Actually, I've eeeeeeeever so slowly been learning SQL, so I solved this problem a while ago. ^_^