none
Background error messages RRS feed

  • Question

  • Hi all,

    I am using WORD automation to export some data as a report. All works fine.

    One of my users did something while the automation ran, so when she ran the report the next time, an error message popped up saying something to the effect of "The last time you opened file xxxx,docx, it caused a serious error. Do you still want to open?" with a YES and NO button. Clicking the YES button, the report is continued with no problems.

    My issue is that this message from WORD is behind the MS Access application and the user cannot see the message. It looks like the Access application has freezed, but actually it is waiting a response from the WORD error message, and because the user can't see the message, she uses Ctrl, Alt and Del to get out of the Access application. Only then does the WORD error message become visible to the user.

    Is there a way that I can push the error message to the foreground so that it becomes visible to the user?

    Thanks

    Deon

    Thursday, January 17, 2019 2:14 PM

Answers

  • Hi Deon,

    For you to force the error message to the foreground, you'll have to be able to capture it. If you can, then you should be able to use an API to bring it to the front. However, since the error may or may not show up, I was thinking perhaps it might be easier (better?) to simply minimize your Access application while doing the Word Automation, so if any error message comes up from Word, the user would be able to see it (since Access should no longer be visible).

    • Marked as answer by Deon SA Friday, January 18, 2019 10:53 AM
    Thursday, January 17, 2019 4:17 PM
  • You can use code such as https://www.everythingaccess.com/tutorials.asp?ID=Bring-an-external-application-window-to-the-foreground to bring Word to the foreground before doing anything else and the pop-up should be visible to the end-user.

    Because of different behaviors between different versions of Access I use similar code to set any program I launch to the foreground to avoid exactly these types of issue and it works great.


    Daniel Pineault, 2010-2018 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net


    Thursday, January 17, 2019 4:23 PM

All replies

  • Hi Deon,

    For you to force the error message to the foreground, you'll have to be able to capture it. If you can, then you should be able to use an API to bring it to the front. However, since the error may or may not show up, I was thinking perhaps it might be easier (better?) to simply minimize your Access application while doing the Word Automation, so if any error message comes up from Word, the user would be able to see it (since Access should no longer be visible).

    • Marked as answer by Deon SA Friday, January 18, 2019 10:53 AM
    Thursday, January 17, 2019 4:17 PM
  • You can use code such as https://www.everythingaccess.com/tutorials.asp?ID=Bring-an-external-application-window-to-the-foreground to bring Word to the foreground before doing anything else and the pop-up should be visible to the end-user.

    Because of different behaviors between different versions of Access I use similar code to set any program I launch to the foreground to avoid exactly these types of issue and it works great.


    Daniel Pineault, 2010-2018 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net


    Thursday, January 17, 2019 4:23 PM
  • Hi guys,

    Both these suggestions work.

    Much appreciated.

    Deon

    Friday, January 18, 2019 10:53 AM
  • Hi Deon,

    Glad to hear you got it worked out. Daniel and I were happy to assist. Good luck!

    Friday, January 18, 2019 4:29 PM