Enable “redo” for MS Access rich-text fields











up vote
1
down vote

favorite












Minimal Repro: (Access 2016)




  1. Create a new, blank database.

  2. Create a new, blank form with a single, large text box.

  3. Set its "Text Format" property to "Rich Text".

  4. Save and open the form in "Form view".

  5. Enter a lot of text.

  6. Hit Ctrl-Z to undo, because you made a typo in the last word.

  7. 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.










share|improve this question


























    up vote
    1
    down vote

    favorite












    Minimal Repro: (Access 2016)




    1. Create a new, blank database.

    2. Create a new, blank form with a single, large text box.

    3. Set its "Text Format" property to "Rich Text".

    4. Save and open the form in "Form view".

    5. Enter a lot of text.

    6. Hit Ctrl-Z to undo, because you made a typo in the last word.

    7. 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.










    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      Minimal Repro: (Access 2016)




      1. Create a new, blank database.

      2. Create a new, blank form with a single, large text box.

      3. Set its "Text Format" property to "Rich Text".

      4. Save and open the form in "Form view".

      5. Enter a lot of text.

      6. Hit Ctrl-Z to undo, because you made a typo in the last word.

      7. 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.










      share|improve this question













      Minimal Repro: (Access 2016)




      1. Create a new, blank database.

      2. Create a new, blank form with a single, large text box.

      3. Set its "Text Format" property to "Rich Text".

      4. Save and open the form in "Form view".

      5. Enter a lot of text.

      6. Hit Ctrl-Z to undo, because you made a typo in the last word.

      7. 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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 22 at 13:57









      Heinzi

      121k38265402




      121k38265402
























          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.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            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

























            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.






            share|improve this answer



























              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.






              share|improve this answer

























                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.






                share|improve this answer














                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.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 22 at 14:36

























                answered Nov 22 at 14:30









                Erik von Asmuth

                18.1k51938




                18.1k51938






























                    draft saved

                    draft discarded




















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    What visual should I use to simply compare current year value vs last year in Power BI desktop

                    How to ignore python UserWarning in pytest?

                    Alexandru Averescu