MsgBox position

A

Al Campagna

I just ran into something weird... (Access97 vs. Access 2003)
I was working on a sample file for my website (how to create custom menubar buttons
that use Macros or VB Functions). That involves opening a MsgBox via a macro, and another
that opens a MsgBox via VB module code.

In Access 97 , BOTH MsgBoxes appear in the same place on the form (about 2/3 up an
centered) and I adjusted other objects on the form accordingly. That works fine...
Converted the 97 file to 2003 and now the "Macro" called MsgBox positions exactly the
same as in 97, but... the "VB" called MsgBox appears about 2 inches lower... covering some
of my objects.

Wassup with that? Never noticed that before, because I never use Macros.
Has anyone else experienced this problem?
Anything I'm missing here?

Just curious... I won't bother to create a dialog pop-up form just get around this
issue... but it seems pretty odd that they wouldn't position the same.

Thanks,
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
D

Dirk Goldgar

Al Campagna said:
I just ran into something weird... (Access97 vs. Access 2003)
I was working on a sample file for my website (how to create
custom menubar buttons that use Macros or VB Functions). That
involves opening a MsgBox via a macro, and another that opens a
MsgBox via VB module code.

In Access 97 , BOTH MsgBoxes appear in the same place on the form
(about 2/3 up an centered) and I adjusted other objects on the form
accordingly. That works fine... Converted the 97 file to 2003 and
now the "Macro" called MsgBox positions exactly the same as in 97,
but... the "VB" called MsgBox appears about 2 inches lower...
covering some of my objects.

Wassup with that? Never noticed that before, because I never use
Macros. Has anyone else experienced this problem?
Anything I'm missing here?

Just curious... I won't bother to create a dialog pop-up form just
get around this issue... but it seems pretty odd that they wouldn't
position the same.

I suspect it's the same issue that is described in this KB article:

http://support.microsoft.com/kb/242889/en-us
ACC2000: MsgBox Function Ignores At Sign (@) Formatting

Essentially, the VBA MsgBox function in Access 2000 and later is not the
same function as was built into Access 97. The MsgBox macro action
calls the old function, while VBA code calls the new one.
 
A

Al Campagna

Thanks Dirk...
That certainly sounds like the problem. Unfortunately, I'm demonstarting how to call a
VB Public Function from a custom menu button, so I'm stuck using the code method for the
MsgBox.
In my normal designs, I would be calling the MsgBoxes by code in both cases, so the
position difference issue wouldn't apply.
I take it... that since you didn't mention any knowledge of a "workaround", that there
is none (other than a form "psuedo" msgbox).
Thanks a lot for the info,

Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
D

Douglas J. Steele

If you're unwilling to have your own "pseudo" msgbox, you should be able to
hook the msgbox and use APIs to move it.
 
D

Dirk Goldgar

Al Campagna said:
Thanks Dirk...
That certainly sounds like the problem. Unfortunately, I'm
demonstarting how to call a VB Public Function from a custom menu
button, so I'm stuck using the code method for the MsgBox.
In my normal designs, I would be calling the MsgBoxes by code in
both cases, so the position difference issue wouldn't apply.
I take it... that since you didn't mention any knowledge of a
"workaround", that there is none (other than a form "psuedo" msgbox).

Your macro should be able to call a user-defined function that calls the
VBA MsgBox function. Have you tried that?
 
A

Al Campagna

Douglas and Dirk,
As far as API's go... I'd would probably just whip out a "form" msgbox instead. Much
easier...
I have already looked over several API codings I found in the Google groups for MsgBox
positioning, and
being able to position VB coded msgboxes would be a very useful trick to learn.

I'll just do the form after all...
I'm a great believer in the old chestnut... "Don't whiz into the wind"... :-D

I wasn't refusing to do a form, but I just didn't think it was that critical for this
sample file.
More of a case of curiousity as to the difference in how Access positions MsbBoxes.
And as I mentioned, this is the only app where I use Macros at all, so it's not a serious
problem in my "normal" programming.

This sample file is for "new" users so I wanted the Macro button to call a "pure"
MsgBox Action, (which they would probably find easier to digest)
and the VB button to call a VB function for code users. New users wouldn't have to deal
with any module code if they wanted to use just the Macro method.

I saw (in Macros) that there is a RunCode option, but... for new users, that would
involve dealing with module code. Using a form MsgBox will allow me to demonstrate the
two "distinct" methods.

Thank you both for your help,

Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
A

Al Campagna

Douglas,
This is a good suggestion also. Didn't quite understand why you referenced it, but now
I see that this method forces Access to use the "Action" msgbox.
Pretty slick....
Thanks a lot,
Al Campagna
 

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