Message box

B

Boon

Hi,

When using this function msgbox(.....) to create a message box, is there a
way to specify the position of the text box to pop up? For example, I want
it to pop up in the top-center of the window screen.

Thank you,
Boon
 
D

Dirk Goldgar

Boon said:
Hi,

When using this function msgbox(.....) to create a message box, is there a
way to specify the position of the text box to pop up? For example, I
want it to pop up in the top-center of the window screen.


No, you have no control over the dialog displayed by the MsgBox function.
You can design your own dialog form, and display it where you like, or you
can probably use Windows API calls if you want to get complicated.
 
B

Boon

Hi,

thanks for your answer. So if I use a form to do this. How can I specify the
position then ?

thanks
 
D

Dirk Goldgar

Boon said:
Hi,

thanks for your answer. So if I use a form to do this. How can I specify
the position then ?


Probably the simplest method would be to design the form with its AutoCenter
property set to Yes, and then have code in the form's Open event that moves
it to the top of the Access window, using a statement like this:

Me.Move Me.WindowLeft, 0

You may possibly be using a version of Access that predates the introduction
of this statement, in which case you might use DoCmd.MoveSize instead.

I note that your original message said you want the message form to appear
in the "top-center of the window screen." I'm not sure whether that means
you want the message to appear outside the Access application window. If
so, the above code won't do it. The form would need to be set as PopUp, and
you'd need to use more complex code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top