How to redirect to another report from a Message Box

noobmaster

New member
Local time
Yesterday, 23:19
Joined
Sep 2, 2019
Messages
5
Is it possible to open a report through a MessageBox alert?
For example maybe a button in the MessageBox that redirects to a report.
 
Hi. Welcome to AWF! The standard message box can only have buttons labeled like Ok, Yes, No, and Cancel. You can make your code react to whichever button the user clicks.
 
I did a search but must have been asking the wrong questions because I can't find the article I vaguely remember on this. The forum search wasn't specific enough in this case and of course NONE of the titles seemed relevant. I think it was this forum but it might not have been here.

The only way I recall seeing this done with customized message box buttons (i.e. Yes, No, OK, Cancel, Retry, Ignore) was that someone built a pop-up form and turned off all sorts of form closure features (so that you could not just dismiss it without making a choice). He made it a modal form that was "always on top" of the screen and built a series of command buttons with the various responses as desired. All of the responses ended up closing the form in an orderly fashion.

The problem of course is that the form had to return any particular value to its caller in a non-standard way i.e. not as a simple intrinsic function does - because it was not an intrinsic function.

The message box function really does this anyway, but as a black box that you cannot see into in order to change anything. But in the context of this special form, you could do darn near anything you wanted to do from behind the buttons.

It is NOT a trivial exercise, not for the faint of heart, and not something you would "whip up" in a couple of hours, mostly because of the complexity of the implied linkages back to the caller.
 
You can rename the buttons (with length restriction of course, don’t want massive buttons) and then you an If statement to catch the button pressed ie.

Code:
If intButton = vbButton1 Then
    ‘Vba code to open report
Else
    ‘Other code here
End If


Sent from my iPhone using Tapatalk
 
I have a blog about advanced message boxes here:-

https://www.niftyaccess.com/advanced-message-box/

there's some code at the bottom and several videos explaining how it works.

Also Colin "Isladog" has a message box example on his website, the link to Colins example, along with a brief description is available on my blog page above.

Sent from my Pixel 3a using Tapatalk
 
A standard message box will do what you want perfectly.
If you want to improve the appearance of the message box then you have several choices
1. As Tony mentioned, I have a Formatted Message Box which allows you to make part of the text bold
2. Use the Enhanced Message Box described by nhorton
3. Create your own customised popup form. There's an example in my Attention Seeking database
But none of those are absolutely necessary to do what you want here
 
Last edited:

Users who are viewing this thread

Back
Top Bottom