tshaffer13
asked on
Undo feature
I created a form that loads some data and the user may or may not change the data. I have an "Accept" button and a "Cancel" button. The "Accept" button works, but I'm having a little trouble with the "Cancel" button. I want the "Cancel" button to undo ANY changes made and the close the form. Problem is, if no changes are made and the "Cancel" button is clicked, I get the message "The undo feature is not available now."
How can I code it to check to see if data has changed? If it has, then undo and close, if not, just close the form.
Thanks.
How can I code it to check to see if data has changed? If it has, then undo and close, if not, just close the form.
Thanks.
I could've sworn there was a flag/property setting that changes when a record is edited, but I can't seem to find it on first look. Maybe that's in VB... oh well.
Why don't you disable the cancel button until a user updates the data? You could set the "Enabled" property to "No", then on an event for each of you controls/fields (After Update?) you can set the cancel button's "Enabled" property to "Yes".
I'll have another look for the Undo flag, I know it's somewhere!
Cheers,
Mike
Why don't you disable the cancel button until a user updates the data? You could set the "Enabled" property to "No", then on an event for each of you controls/fields (After Update?) you can set the cancel button's "Enabled" property to "Yes".
I'll have another look for the Undo flag, I know it's somewhere!
Cheers,
Mike
Thanks heer! Knew it was somewhere :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Me.Undo works great - BUT - if a new record has been created on the form, and then the user clicks cancel - that record is STILL being saved in a table.
How can I prevent that newly created record from being saved to a table if the user selects cancel???
How can I prevent that newly created record from being saved to a table if the user selects cancel???
ASKER
ok... My fault... I checked my table and the new record isn't there. I was just going by the autonumber field on my form. I saw that regardless if I hit "Accept" or "Cancel" the next new record would be the next autonumber. If I hit cancel, the record DOESN'T save, but the numbering continues.
Sorry. Thanks for eveyone's help - and fast help at that! But I can only give points to one... so since I used shanesuebsahakam's (what a name!) comment and it was the easiest, I'm giving him the points.
Thanks to all!
Sorry. Thanks for eveyone's help - and fast help at that! But I can only give points to one... so since I used shanesuebsahakam's (what a name!) comment and it was the easiest, I'm giving him the points.
Thanks to all!
if Me.Dirty = True then Me.Undo