Converting a standard Access MsgBox to a Dynamic MsgBox with timeout.

xavier.batlle

Active member
Local time
Today, 23:02
Joined
Sep 1, 2023
Messages
255
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
 
Good day!

It's so nice to know about this DynamicMsg.
I'm trying out this DM, but I'm not sure if it's working correctly.
I've also attached the file."

on 03/18/2026
Lately been observed, on modTimeoutMsgBox
Case vbYesNo
If defBtn = MB_DEFBUTTON2 Then idToClick = IDNO Else idToClick = IDYES

Could be
If defBtn = MB_DEFBUTTON2 Then idToClick = IDyes Else idToClick = IDno

Next is
If RunCount >= TargetIterations Then
outputMsg = "The TIMER closed the MsgBox, default button value: "
Else
outputMsg = "The user pressed the button: "

Could be
outputMsg = "TIMER=0, value as: "
Else
outputMsg = "Modification is allowed…”
 

Attachments

Last edited:

Users who are viewing this thread

Back
Top Bottom