Undo
By Richard Rost
4 days ago
How To Undo Record Changes In Microsoft Access In this lesson, we will cover how the Undo feature works in Microsoft Access, including its limitations compared to other Office programs like Word. We will discuss how you can undo changes to a field or an entire record, what happens once a record is saved, and the restricted functionality of the Redo command. I will also show you how to add your own Undo button using VBA and explain what is involved if you want to build a more advanced, multi-level Undo system to track and revert past changes. Vincent from Milwaukee, Wisconsin (a Platinum Member) asks: How can I undo changes in Microsoft Access after I accidentally edited the wrong customer's information? I work in a small office and sometimes I'm moving too fast between records and don't realize I changed something until a second later. Is there a way to undo it like Ctrl+Z in Word or Excel, and can I make my own undo button? PrerequisitesLinksRecommended Courses
Keywords TechHelp Access, Undo, Redo, undo changes, undo button, VBA undo, form undo, Me.Undo, data macros, change log, logging edits, step backward, undo history, multi-level undo, field undo, record undo, DoCmd.RunCommand, dirty record, edit tracking, customer change log, AccessLearningZone
Subscribe to Undo
Get notifications when this page is updated
Intro In this lesson, we will cover how the Undo feature works in Microsoft Access, including its limitations compared to other Office programs like Word. We will discuss how you can undo changes to a field or an entire record, what happens once a record is saved, and the restricted functionality of the Redo command. I will also show you how to add your own Undo button using VBA and explain what is involved if you want to build a more advanced, multi-level Undo system to track and revert past changes.Transcript Ever realize you changed the wrong record in Microsoft Access three customers ago and wish there was a way to roll everything back like Control Z in Word? Welcome to another TechHelp video brought to you by AccessLearningZone.com. I am your instructor Richard Rost.
Today we are going to talk about Undo and Redo in Microsoft Access, how Access handles Undo differently from other Office programs, what happens after a record gets saved, and how you can add your own Undo button with a little VBA. We will also talk about what it takes to build a real multi-level Undo system if you want something more advanced.
We are going to start off today for the beginners and teach you how Undo and Redo work in Microsoft Access, then we will do a tiny little bit of development and I will show you the VBA Undo command.
Today's question comes from Vincent in Milwaukee, Wisconsin, one of my platinum members. Vincent says, How can I undo changes in Microsoft Access after I have already saved the record and moved on to editing other records? Sometimes I am flying through customer updates at work and I do not notice a mistake until two or three records later. Is there a way to step backward through the previous changes like an Undo history or do I need to build something custom for that?
Well, to answer your question in a nutshell, Vincent, Access does have some basic Undo capabilities built in. You can undo a field, you can undo a record, you can even undo the previously saved record one time.
But if you want something more advanced than that, like full multi-level Undo history, then you are going to have to build that yourself. We will talk about why a little bit later.
But first, let us take a look at how Undo does work in Microsoft Access.
All right, here I am in the TechHelp free template. This is a free database you can grab a copy of from my website if you want to and let's just open up the customer form and you will see once you start typing, this record goes dirty. See, a little pencil there. That's what that means. That means that the record is currently being changed. If you want to learn more about that, go watch my dirty video.
Now, if you decide at this point, you do not like that change, there are three things you can do. You can click on the Undo button, you can hit Control Z or you can hit Escape and that will cancel your changes.
All right, now let's say you edit a couple of fields. Let's say I edit this one, hit Tab, edit this one, hit Tab again, edit this one. Now, here is where Undo gets a little weird. If I hit Undo the first time, it undoes the field that I am on. If I hit Undo a second time, nothing appears to happen. I will explain why in a second. And then if I hit Undo a third time, it undoes the whole field. So you cannot just step back through the fields that you edited. It is the current field that you are on or the whole record.
Why is there that second one that does not work? So, when you are actively typing in a field, the first Undo undoes that field edit, then the second Undo exits edit mode and then the third Undo undoes the record itself, the whole record. It is weird, I know, that is just how it works. But bottom line, you can either undo the field you are working on or the entire record. You cannot just step back through the fields.
So it is not like Word and Excel. You cannot just step back through individual changes. It is either the field you are editing or the whole record.
Now, after you move off a field, you get one Undo. So if I put something in here, move to the next record, and I realize, oh wait a minute, I goofed, I want to undo that. If I hit Undo, it puts that one back. But if you make two changes, if I put this in here, and then I go and edit James Kirk, and then I go over here, I hit Undo now, it fixes James Kirk, but that is it. You get one. So realize your mistake quickly. Note to the Access team: This would be a pretty cool feature if you could add in some extra Undo for people.
That would be nice. Basically, the logic is Access is a database. It is not a document editor. So they do not have a huge long Undo history.
Redo is very limited as well. If I change James to Jim, and then realize I did not want that, I can undo it. But you do not always get a redo. Sometimes it is only if you are still editing that record, and then I undo. Now I can get a redo, but that is it. And if you change this altogether, and move to a different record, and undo it, sometimes you do not get the redo. So again, redo is extremely unreliable when you actually get a redo.
Now you might notice I got a little undo button over here. This is for the developer students. You can make your own undo button. And that is just simply create a button and it is one command: Me.Undo. There is also a DoCmd, I think it is DoCmd.RunCommand, acCmdUndo. That is for backward compatibility with older versions. You want to use Me.Undo. And it has the same restrictions and same limitations as the button out here. And no, there is no Me.Redo. You cannot do it.
Now Vincent, to answer your question, if you want true multi-level Undo, that is a whole different animal. You can build something like that yourself but Access does not do it automatically. So you would have to track your own changes in a table somewhere, keep a history of what records and what fields were modified on what table or what form, and then use a little bit of VBA and ask you how to step backward through those changes manually.
Now I have got several other videos where I show you how to do this. This video shows you how to log changes made to Access at a data macro level, so right at the table level itself. And this video actually shows you how to create that customer change log. So I show you how to log every change made to every field, or to all the fields if you want, and timestamp it. So you could step backwards through those changes. Just track the new value and the old value in the log table. And then you can step backward through those with your undo button.
Now if you guys would like to see me build a complete walkthrough video showing a multi-level Undo system, post a comment down below and let me know. If enough people are interested, I will make a video on it. It is not super hard. You just have to track the changes in a table, mark which ones have been undone, so that way you could step backwards through them, forward if you want to redo. But yeah, it would definitely make an interesting video. So post a comment down below, let me know if you are interested.
So today we learned that Microsoft Access can undo changes to an entire record before it is saved but it does not work like Word or Excel with a long history of edits. But that is just how Access works.
Leave a comment down below. Let me know what you would like to see moving forward. And if you have any questions about this stuff, but that is going to be your TechHelp video for today brought to you by AccessLearningZone.com.
I hope you learned something. Live long and prosper my friends. I will see you next time.Quiz Q1. How does Undo in Microsoft Access differ from Word or Excel? A. Access does not provide a multi-level Undo history like Word or Excel B. Access allows unlimited Undo and Redo actions C. Access tracks every single keystroke for Undo D. Undo in Access works exactly the same as in Word
Q2. What does the pencil icon signify in a Microsoft Access form record? A. The record is being deleted B. The record is currently being edited (dirty) C. The record is read-only D. The record is locked by another user
Q3. Which of the following actions will allow you to Undo a change while editing a record in Access? A. Click the Undo button, press Control Z, or hit Escape B. Save and close the database C. Run Compact and Repair D. Delete the record
Q4. What is the limitation of Undo in Microsoft Access forms after moving to another record? A. You can only undo the previous record one time B. You can undo all records you have edited C. You can undo up to ten records back D. There is no limitation; unlimited undo is available
Q5. When editing multiple fields in a record, what does the Undo function do? A. Only undoes the current field change or the whole unsaved record B. Steps back through every field individually that was changed C. Undoes all changes across all records D. Converts the record to its initial state regardless of saving
Q6. What VBA command is used for creating a custom Undo button on a form? A. Me.Undo B. Me.Redo C. DoCmd.UndoRecord D. Me.Cancel
Q7. Which statement about Redo in Access is accurate? A. Redo is highly reliable and works for all previous Undo actions B. Redo is only sometimes available and is unreliable after saving or moving records C. Redo lets you redo an unlimited number of changes D. Redo is not available in Microsoft Access
Q8. If you want a multi-level Undo system in Access, what must you do? A. Build it yourself by tracking changes in a table and using VBA B. Enable a built-in multi-level Undo feature in the options menu C. Install an Access update for multi-level Undo D. Use the standard Undo button to access Undo history
Q9. What does the instructor suggest is the reason Access does not have a multi-level Undo history? A. Access is a database, not a document editor B. Microsoft forgot to include the feature C. Access is an old program D. Databases are not used for editing records
Q10. For advanced Undo and change tracking systems, where does the instructor point you for more guidance? A. Videos about logging changes and creating a change log table B. The built-in Access Help system only C. Permanent deletion tutorials D. Creating macros for print preview
Answers: 1-A; 2-B; 3-A; 4-A; 5-A; 6-A; 7-B; 8-A; 9-A; 10-A
DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks.Summary Today's video from Access Learning Zone focuses on how Undo and Redo work in Microsoft Access compared to other Office programs. I want to address a common situation many people encounter: you notice you made a mistake not in the last record but maybe two or three customers ago. In programs like Word, you can use Control Z to keep stepping backwards as far as you want. Many people want to know if something similar exists in Access.
Access does provide some Undo features, but they are much more limited than what you find in Word or Excel. In short, you can undo your last change to a field, undo changes to an entire record if it's still unsaved, or if you've just saved a record and start editing another one, you get one shot at Undo. If you want more than that, such as a multi-level Undo history, you have to build it yourself.
To break this down for those just getting started, when you edit a record in Access, you might notice a small pencil icon that appears. This means that the current record is "dirty" or in the process of being changed. At this point, you have some options: you can click Undo, press Control Z, or hit Escape. All of these will cancel the changes you've made before the record is saved.
If you are editing multiple fields in a single record, Undo behaves a little differently than you might expect. The first undo action will remove the change in the field you are currently in. If you try Undo again without moving fields, sometimes nothing seems to happen because Access leaves edit mode. A third Undo may undo the entire record. You cannot step backwards through each field edit the way you might in Word or Excel. Essentially, Undo works on the field you are editing and then the entire record as a single unit.
As soon as you move off the field or record, you only get one Undo. For instance, if you change a value, then move to the next record, you can Undo your very last change. But if you have already made additional edits to other records, you are only able to undo the most recent one. The takeaway is that Access only remembers the last committed change, so you have to catch your mistakes immediately.
Redo support in Access is similarly restricted. In some situations, particularly if you are still editing a record and just performed an Undo, you can Redo that change. However, after moving away from the record or after certain kinds of edits, Redo will no longer be available. It is unpredictable and unreliable if you are expecting it to work the same way it does in other Office apps.
For developers, you can add your own Undo button to a form with a single command. In VBA, the Me.Undo command will undo the current changes in your form. There is another command for backward compatibility called DoCmd.RunCommand, acCmdUndo, but Me.Undo is the preferred method these days. Remember though, there is no Me.Redo or direct equivalent, so there is no easy way to add Redo support.
If you are looking for a true multi-level Undo system, where you can step backwards through all your previous changes, you will have to create this yourself. This means setting up a log table that tracks every change made to every field in your table, possibly including timestamps and user information. Then, you can use some VBA code to walk back through those logs and reverse the changes as needed.
I have other videos on my website that detail how to create logging systems at both the data macro and form level. Logging changes lets you keep a complete history of all modifications, so you could potentially build a custom Undo/Redo system based on those logs.
If you're interested in me putting together a full video tutorial on how to design a complete multi-level Undo system in Access, let me know by leaving a comment. If there is enough demand, I'll be happy to walk through it step by step. It mainly comes down to saving each change to a separate table and tracking which ones have been undone, allowing you to go backward or forward through them.
In summary, Microsoft Access gives you some limited Undo capability, but it doesn't have the robust multi-level Undo found in Word or Excel. That limitation is built into how Access works as a database program rather than a document editor.
If you want to see a detailed, step-by-step lesson on everything we've discussed here, you can find a complete video tutorial on my website at the link below. Live long and prosper, my friends.Topic List Undo and Redo in Microsoft Access explained How Access handles Undo differently from Word and Excel Undoing field changes vs record changes Limitations of Undo after saving a record How Redo works in Microsoft Access Adding an Undo button with VBA (Me.Undo and DoCmd.RunCommand) Steps to create a multi-level Undo system overview Using a change log table to track edits for undo Real-world examples of Undo actions on formsArticle If you have ever used Microsoft Access and found yourself wishing for a simple way to undo changes like you can with Control Z in Word, you are not alone. Access handles undo and redo differently than other Microsoft Office programs, and it is important to understand how it works so you can avoid losing or accidentally changing data.
In Microsoft Access, undoing changes is possible, but it works with certain limitations. When you are entering or editing data on a form, notice a small pencil icon next to the record you are editing. This means that the record is dirty, or in the process of being changed. At this point, if you realize you made a mistake and want to undo your changes, there are a few simple ways to do it. You can press Control Z, click the Undo button (if it is enabled), or press the Escape key. These actions will cancel the current edit.
Let us go a little deeper. Imagine you are editing several fields in the same record. For example, you change the customer's first name, then tab to the next field and edit the last name, then move to the next field and make another change. If you want to undo your changes, the behavior can seem a little odd. Pressing Undo the first time will undo the changes to the field you are currently on. If you press Undo again, you might see nothing happen, and on the third press of Undo, the whole record can get undone, resetting all the edits made in that session. In practice, you cannot simply step backward through every field you edited one by one, like you might expect from programs like Word or Excel. Access only lets you undo the change in the field you are presently editing or undo the entire record edit if you have not yet saved those changes.
Once you move off the record or save it, your undo options become even more limited. Access gives you one shot to undo the last change you made after you leave a record. If you realize your mistake right away, you can hit Undo and it will revert that last saved change. If you have already moved on and made changes to other records, you can not continue to step backward through your change history. At most, you get one undo per record, and only for the most recent change.
Redo is also very limited in Access. If you undo a change to a field and have not yet moved off the record, sometimes you can redo the change, but this is not always reliable. Once you have moved to another record or saved your changes, redo becomes unavailable.
For those interested in customizing their forms, you can create your own undo button using VBA. This involves adding a command button to your form and setting its On Click event to use the Me.Undo command. For example, in the On Click event of your button, write:
Me.Undo
This will undo the pending changes in the current record. Alternatively, you can use:
DoCmd.RunCommand acCmdUndo
This is an older method, but Me.Undo is the preferred approach now. Note that there is no Me.Redo command in Access, so you cannot create a redo button with the same functionality.
If you are looking for a more advanced method such as multi-level undo, where you can step backward through multiple changes made across several records or fields, Access does not provide this out of the box. To achieve something like this, you need to build a custom change tracking system. This typically involves creating a table to log changes made to your data, storing information such as which record and field was changed, what the old value was, what the new value is, and a timestamp of when the change was made. With this data, you can write VBA code to let the user step backward (or forward, for redo) through their changes. This is more complex, but definitely possible with some effort.
To summarize, Access allows for basic undo and limited redo, but it does not work like a word processor where you can step back through every little change. Your undo options are restricted to the current field or the whole record before saving, and you get only one chance to undo after moving off the record. For more advanced undo capabilities, you will need to create a custom solution that tracks changes for you. If you are interested in building such a system, consider learning more about data macros, change log tables, and writing VBA to handle stepping through those logged changes. This can make Access much more forgiving for users who frequently need to undo or redo data updates.
|