Enable “redo” for MS Access rich-text fields
up vote
1
down vote
favorite
Minimal Repro: (Access 2016)
- Create a new, blank database.
- Create a new, blank form with a single, large text box.
- Set its "Text Format" property to "Rich Text".
- Save and open the form in "Form view".
- Enter a lot of text.
- Hit Ctrl-Z to undo, because you made a typo in the last word.
- Oops, all of your text is gone.
Expected behavior: Hit Ctrl-Y or the "Redo" button in the tool bar to "undo the undo operation" and get your text back.
Actual behavior: Ctrl-Y does nothing, and the "Redo" button in the tool bar is grayed out.
Note: This only happens when the text format is "Rich Text". With "Plain Text" text boxes, Ctrl-Y still does nothing, but at least the "Redo" button is available (unless you hit Ctrl-Z twice, but that is an annoyance for another question).
Question: Is it possible to activate "Redo" for Rich Text text boxes?
Background: We are the developers of an MS-Access-based software product (hence I asked my question here instead of SuperUser), and our customers are (rightly) used to Ctrl-Z being a revertible operation. If there is no built-in support for this feature in Access, ideas for VBA-based workarounds are welcome as well.
ms-access undo-redo
add a comment |
up vote
1
down vote
favorite
Minimal Repro: (Access 2016)
- Create a new, blank database.
- Create a new, blank form with a single, large text box.
- Set its "Text Format" property to "Rich Text".
- Save and open the form in "Form view".
- Enter a lot of text.
- Hit Ctrl-Z to undo, because you made a typo in the last word.
- Oops, all of your text is gone.
Expected behavior: Hit Ctrl-Y or the "Redo" button in the tool bar to "undo the undo operation" and get your text back.
Actual behavior: Ctrl-Y does nothing, and the "Redo" button in the tool bar is grayed out.
Note: This only happens when the text format is "Rich Text". With "Plain Text" text boxes, Ctrl-Y still does nothing, but at least the "Redo" button is available (unless you hit Ctrl-Z twice, but that is an annoyance for another question).
Question: Is it possible to activate "Redo" for Rich Text text boxes?
Background: We are the developers of an MS-Access-based software product (hence I asked my question here instead of SuperUser), and our customers are (rightly) used to Ctrl-Z being a revertible operation. If there is no built-in support for this feature in Access, ideas for VBA-based workarounds are welcome as well.
ms-access undo-redo
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Minimal Repro: (Access 2016)
- Create a new, blank database.
- Create a new, blank form with a single, large text box.
- Set its "Text Format" property to "Rich Text".
- Save and open the form in "Form view".
- Enter a lot of text.
- Hit Ctrl-Z to undo, because you made a typo in the last word.
- Oops, all of your text is gone.
Expected behavior: Hit Ctrl-Y or the "Redo" button in the tool bar to "undo the undo operation" and get your text back.
Actual behavior: Ctrl-Y does nothing, and the "Redo" button in the tool bar is grayed out.
Note: This only happens when the text format is "Rich Text". With "Plain Text" text boxes, Ctrl-Y still does nothing, but at least the "Redo" button is available (unless you hit Ctrl-Z twice, but that is an annoyance for another question).
Question: Is it possible to activate "Redo" for Rich Text text boxes?
Background: We are the developers of an MS-Access-based software product (hence I asked my question here instead of SuperUser), and our customers are (rightly) used to Ctrl-Z being a revertible operation. If there is no built-in support for this feature in Access, ideas for VBA-based workarounds are welcome as well.
ms-access undo-redo
Minimal Repro: (Access 2016)
- Create a new, blank database.
- Create a new, blank form with a single, large text box.
- Set its "Text Format" property to "Rich Text".
- Save and open the form in "Form view".
- Enter a lot of text.
- Hit Ctrl-Z to undo, because you made a typo in the last word.
- Oops, all of your text is gone.
Expected behavior: Hit Ctrl-Y or the "Redo" button in the tool bar to "undo the undo operation" and get your text back.
Actual behavior: Ctrl-Y does nothing, and the "Redo" button in the tool bar is grayed out.
Note: This only happens when the text format is "Rich Text". With "Plain Text" text boxes, Ctrl-Y still does nothing, but at least the "Redo" button is available (unless you hit Ctrl-Z twice, but that is an annoyance for another question).
Question: Is it possible to activate "Redo" for Rich Text text boxes?
Background: We are the developers of an MS-Access-based software product (hence I asked my question here instead of SuperUser), and our customers are (rightly) used to Ctrl-Z being a revertible operation. If there is no built-in support for this feature in Access, ideas for VBA-based workarounds are welcome as well.
ms-access undo-redo
ms-access undo-redo
asked Nov 22 at 13:57
Heinzi
121k38265402
121k38265402
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
I don't think it's possible to activate Redo. However, you can implement it yourself using a bit of VBA (by listening to the Ctrl + Z key combination, if it occurs, store the text, if Ctrl + Y occurs, then revert the text to the last Ctrl + Z)
Dim lastUndo As String
Private Sub MyRichTextbox_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyZ And Shift And acCtrlMask = acCtrlMask Then
lastUndo = MyRichTextbox.Text
ElseIf KeyCode = vbKeyY And Shift And acCtrlMask = acCtrlMask Then
Dim t As String
t = MyRichTextbox.Text 'Allow for toggling undo
MyRichTextbox.Text = lastUndo
lastUndo = t
End If
End Sub
You can, of course, move this logic to a separate class, and then apply it to all rich text controls on a form on form load (or all that have a specific tag). That would make it easier to manage this for a project.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
I don't think it's possible to activate Redo. However, you can implement it yourself using a bit of VBA (by listening to the Ctrl + Z key combination, if it occurs, store the text, if Ctrl + Y occurs, then revert the text to the last Ctrl + Z)
Dim lastUndo As String
Private Sub MyRichTextbox_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyZ And Shift And acCtrlMask = acCtrlMask Then
lastUndo = MyRichTextbox.Text
ElseIf KeyCode = vbKeyY And Shift And acCtrlMask = acCtrlMask Then
Dim t As String
t = MyRichTextbox.Text 'Allow for toggling undo
MyRichTextbox.Text = lastUndo
lastUndo = t
End If
End Sub
You can, of course, move this logic to a separate class, and then apply it to all rich text controls on a form on form load (or all that have a specific tag). That would make it easier to manage this for a project.
add a comment |
up vote
1
down vote
I don't think it's possible to activate Redo. However, you can implement it yourself using a bit of VBA (by listening to the Ctrl + Z key combination, if it occurs, store the text, if Ctrl + Y occurs, then revert the text to the last Ctrl + Z)
Dim lastUndo As String
Private Sub MyRichTextbox_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyZ And Shift And acCtrlMask = acCtrlMask Then
lastUndo = MyRichTextbox.Text
ElseIf KeyCode = vbKeyY And Shift And acCtrlMask = acCtrlMask Then
Dim t As String
t = MyRichTextbox.Text 'Allow for toggling undo
MyRichTextbox.Text = lastUndo
lastUndo = t
End If
End Sub
You can, of course, move this logic to a separate class, and then apply it to all rich text controls on a form on form load (or all that have a specific tag). That would make it easier to manage this for a project.
add a comment |
up vote
1
down vote
up vote
1
down vote
I don't think it's possible to activate Redo. However, you can implement it yourself using a bit of VBA (by listening to the Ctrl + Z key combination, if it occurs, store the text, if Ctrl + Y occurs, then revert the text to the last Ctrl + Z)
Dim lastUndo As String
Private Sub MyRichTextbox_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyZ And Shift And acCtrlMask = acCtrlMask Then
lastUndo = MyRichTextbox.Text
ElseIf KeyCode = vbKeyY And Shift And acCtrlMask = acCtrlMask Then
Dim t As String
t = MyRichTextbox.Text 'Allow for toggling undo
MyRichTextbox.Text = lastUndo
lastUndo = t
End If
End Sub
You can, of course, move this logic to a separate class, and then apply it to all rich text controls on a form on form load (or all that have a specific tag). That would make it easier to manage this for a project.
I don't think it's possible to activate Redo. However, you can implement it yourself using a bit of VBA (by listening to the Ctrl + Z key combination, if it occurs, store the text, if Ctrl + Y occurs, then revert the text to the last Ctrl + Z)
Dim lastUndo As String
Private Sub MyRichTextbox_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyZ And Shift And acCtrlMask = acCtrlMask Then
lastUndo = MyRichTextbox.Text
ElseIf KeyCode = vbKeyY And Shift And acCtrlMask = acCtrlMask Then
Dim t As String
t = MyRichTextbox.Text 'Allow for toggling undo
MyRichTextbox.Text = lastUndo
lastUndo = t
End If
End Sub
You can, of course, move this logic to a separate class, and then apply it to all rich text controls on a form on form load (or all that have a specific tag). That would make it easier to manage this for a project.
edited Nov 22 at 14:36
answered Nov 22 at 14:30
Erik von Asmuth
18.1k51938
18.1k51938
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53432584%2fenable-redo-for-ms-access-rich-text-fields%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown