Converting a standard Access MsgBox to a Dynamic MsgBox with timeout. (1 Viewer)

xavier.batlle

Active member
Local time
Today, 23:23
Joined
Sep 1, 2023
Messages
254
After reading this article by Colin Riddington also known as @isladogs :
https://isladogs.co.uk/msg-box-timeout/index.html
I've been experimenting with this topic and discovered that we can change the title, message, or button caption of a standard MsgBox after it has been displayed using some Windows API. With this approach, I've converted a standard Access MsgBox into a dynamic MsgBox with a timeout.

1773572496158.png


This example was developed just for fun!
 

Attachments

Last edited:
Very clever. As you will know from our discussions, I thought it wasn't possible to interact with the message box contents after opening. I believed that as they are modal, the messages by definition could only be static.

In the next couple days, I will be publishing my own example which uses a MsgBoxT function to create (amongst other things) a new style message box with a timeout. The article isn't finished but the app is available for download now at

I wonder if its possible to integrate this approach into my own function which is based on the message box created by the Access expression service
 
Last edited:
I wonder if its possible to integrate this approach into my own function which is based on the message box created by the Access expression service
Surely this approach can be used into your function, but AFAIK only for the old MsgBox style, not for the new ones that can be used in MS Access 365.
 
In my function, the timeout procedure grabs the message box handle and closes that window once the specified time has completed.
You are intercepting the message each second and modifying it as the timer counts down. I hadn't considered doing that.

Whether that approach will work with the Eval function in my code is indeed the question.
Mine is primarily intended for use with the new style message box and not the VBA MsgBox function.

BTW I expect your code won't work with Unicode characters due to using FindWindowA in the timer handle code rather than FindWindowW
 

Users who are viewing this thread

Back
Top Bottom