Position Msgbox

A17BPG

New member
Local time
Yesterday, 17:22
Joined
Mar 30, 2018
Messages
23
Hi

Does anyone know if you can place a msgbox anywhere on a Form other than in the centre. ie placing say on the right or in a top corner.

Thanks in anticipation Brian.
 
Dont think so but you could use a form made to look like a message box then move it where you wanted I know isladog posted code for moving a form.

Hope it helps mick
 
The only way to do that is if the message box is NOT modal (which means that other code can run behind it) but it also requires you to find ALL windows (including child windows) to find which one is the message box. If you could run code AND if you could find the child box, you would be able to manipulate is positional properties.

However, that is not something that is easy to do. The whole point of a message box is that it is up front and dead center in order to get your attention and MAKE you do something, choose something. To do otherwise is to defeat its purpose.

I think MickJay's suggestion is better... if the purpose isn't to force someone to decide something, then maybe it shouldn't be a message box.
 
I can envision a situation where the message box might cover some vital information that pertains to the message, and if you can't see that information, it may be problematic in dealing with the message. Don't forget that the message box may not be one that results in a simple OK response - it could contain 3 options and the info may need to be seen in order to facilitate a choice.

If that is the case, I'd go with a form as suggested, but make it modal. Seems obvious to me that if a decision needs to be made, there ought not to be any further code execution until the choice is made, so modal ought to function well in a case like this.
EDIT - forgot to say that the MoveSize method used in form opening may be simple enough for positioning such a form.
 
As previously mentioned, you can make your own message form and place it where you like. See the customised message box in my example Attention Seeking app.
I would also make it popup and modal so the user has to respond in order to proceed.
The code to place it where you want has the syntax
Code:
DoCmd.MoveSize Left, top, width, height
with all arguments optional. Values are in twips with 1440 twips = 1 inch (567 tips = 1 cm)

If you want to place the form precisely in relation to another object, see this article on my website Accurately Move Forms and Controls
 
Last edited:
Let's not forget that you CAN manually drag a modal message box to the side to see things if it is covering up something. You just can't do anything underneath it.
 
I submitted the same (code repository) for the mods approval.
 

Attachments

Users who are viewing this thread

Back
Top Bottom