Is it possible to set message box positions on forms?

J

Jan Il

Hi all - Access 2000, WinME

I have a new data entry form which has various message boxes which may
appear during the entry process. One is a message box that asks if the user
is sure they want to save the record when the save button is clicked, in
order to give the user a chance to make any corrections to the entries
before the record is actually saved. The entry controls are spanned across
the form, each represents a separate type of inspection. However, when the
message box comes up, it sits square in the middle of the form, blocking
several of the controls, thus if there are any entries in those controls,
the user can't see them. While it is possible to just click on and drag the
message box lower on the form, I am truly doubtful many of the users will
take the time to do this to double check the entries, assume it is correct
and just go ahead and save the record, correct or not. Therefore, I was
wondering if it is possible to somehow specify a position for the message
box to appear on the form that will not block the row of entry controls? I
have searched the Help files, and the KB's, but, have not been able to find
anything yet that addresses how to specify a particular place in the form
for the message box to appear all the time.

IIRCC, I think there was a similar question posted on this or another of
these newsgroups some time ago, and a solution posted by one of the
responders, but, I can't recall the exact subject title to look in Google. I
thought perhaps it might be either in the form itself, or a Macro or code.
Then again, maybe it was a bit of a trick done with a text box or label.

Just thought I'd first see if someone here might know of such a way to
designate a specific placement for a message box on a form before I went
through the trouble of revamping the form. I'd really appreciate any
suggestions or references, if any, that would shed some information about
how/where it can be done, if it is possible.

Very best regards,
Jan :)
 
F

Fredg

Jan said:
Hi all - Access 2000, WinME

I have a new data entry form which has various message boxes which may
appear during the entry process. One is a message box that asks if the user
is sure they want to save the record when the save button is clicked, in
order to give the user a chance to make any corrections to the entries
before the record is actually saved. The entry controls are spanned across
the form, each represents a separate type of inspection. However, when the
message box comes up, it sits square in the middle of the form, blocking
several of the controls, thus if there are any entries in those controls,
the user can't see them. While it is possible to just click on and drag the
message box lower on the form, I am truly doubtful many of the users will
take the time to do this to double check the entries, assume it is correct
and just go ahead and save the record, correct or not. Therefore, I was
wondering if it is possible to somehow specify a position for the message
box to appear on the form that will not block the row of entry controls? I
have searched the Help files, and the KB's, but, have not been able to find
anything yet that addresses how to specify a particular place in the form
for the message box to appear all the time.

IIRCC, I think there was a similar question posted on this or another of
these newsgroups some time ago, and a solution posted by one of the
responders, but, I can't recall the exact subject title to look in Google. I
thought perhaps it might be either in the form itself, or a Macro or code.
Then again, maybe it was a bit of a trick done with a text box or label.

Just thought I'd first see if someone here might know of such a way to
designate a specific placement for a message box on a form before I went
through the trouble of revamping the form. I'd really appreciate any
suggestions or references, if any, that would shed some information about
how/where it can be done, if it is possible.

Very best regards,
Jan :)

Jan,
You can do this if you use your own unbound form as message holder.
Simple enough to do. As a matter of fact, you just need one form,
changing the value of the label by code to what ever text is
appropriate. It's position on the screen can be changed via code, using
the MoveSize method. All of this information can be passed from an event
in the first form to the opening message form using the OpenForm method
and it's OpenArgs argument.

DoCmd.OpenForm "MessageForm", , , , , acDialog, "This is the text I want
to pass to the form. | 4320, 2880"
* Note, always use 4 digits for the positioning argument, even if the
value should be less than 1000 (i.e. 0750)
The value is in Twips.. 1440 per inch

The OpenArgs argument can then be read in the message form's Load event:

If Not IsNull(OpenArgs) Then
Dim intX As Integer
Dim intY As Integer
LabelName.Caption = Left(OpenArgs, InStr(OpenArgs, "|") - 1)
intX = Val(Mid(OpenArgs, InStr(OpenArgs, "|") + 2, 4))
intY = Val(Right(OpenArgs, 4))
DoCmd.MoveSize intX, intY
End If

The form will display the appropriate messa, and will appear 3 inches
from the left, 2 inches from the top of the screen.
 
J

Jan Il

Hi Mike!

MikeB said:
Google > vb msgbox position api

http://www.codeguru.com/forum/showthread.php?threadid=20567

Scroll down to Re: msgbox position

Super! Ahmm...sheesh...that's really some 'lil piece of code! Whooo!
Gotta tell ya one thing, if that msg box don't sit and stay where I tell it
to after that....it can dang well sit anywhere it wants! 8-o!!

Thank you very much for your time and information, I really appreciate it.

Best regards,
Jan :)
 
J

Jan Il

BTW...that is a very good site..I did not know about that one before.
Ahh...a new clothesline...<g>

Thanks again!

Jan :)
 
J

Jan Il

Hi Fred!

Fredg said:
code.

Jan,
You can do this if you use your own unbound form as message holder.
Simple enough to do. As a matter of fact, you just need one form,
changing the value of the label by code to what ever text is
appropriate. It's position on the screen can be changed via code, using
the MoveSize method. All of this information can be passed from an event
in the first form to the opening message form using the OpenForm method
and it's OpenArgs argument.

DoCmd.OpenForm "MessageForm", , , , , acDialog, "This is the text I want
to pass to the form. | 4320, 2880"
* Note, always use 4 digits for the positioning argument, even if the
value should be less than 1000 (i.e. 0750)
The value is in Twips.. 1440 per inch

The OpenArgs argument can then be read in the message form's Load event:

If Not IsNull(OpenArgs) Then
Dim intX As Integer
Dim intY As Integer
LabelName.Caption = Left(OpenArgs, InStr(OpenArgs, "|") - 1)
intX = Val(Mid(OpenArgs, InStr(OpenArgs, "|") + 2, 4))
intY = Val(Right(OpenArgs, 4))
DoCmd.MoveSize intX, intY
End If

The form will display the appropriate messa, and will appear 3 inches
from the left, 2 inches from the top of the screen.

Yeahhh...now this looks like I might be able to get through it before I wind
up with blue tinted hair and anklesox and Wedgies, and can still remember
why I cared where the msg box was in the first place??

Thanks Fred, I truly appreciate you time to help. I'll give this a go and
see what happens. At the least, Ubo will just throw me out and lock the
door..... <sigh>

Jan :)
 

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