Trouble maximizing a modal popup

M

Martureo Bob

I have a modal popup form with an OnOpen event.

In the OnOpen event code, I perform some setup of various headings on the
form, and end with the following:

DoCmd.Maximize

This seems to work fine --- the form opens maximized.

However, if I put a MsgBox in the OnOpen event **prior to** maximizing the
form, the form does not maximize. It opens in a "restored" state (a smaller
form) that the user must then maximize by clicking the maximize button at
the top of the form.

Why would inclusion of a MsgBox prior to the Maximize cause the Maximize to
not function? It seems like it's being ignored!

Bob.
 
K

Keith Leslein

Hi Bob,

Does the Maximize event fire after the user clicks the MsgBox? The
MsgBox is a pop-up/modal dialog box which won't proceed until the user
has interacted with the MsgBox. Place the Maximize command before the
MsgBox to have the form maximize and then the MsgBox will display.

Thanks!
 
M

Martureo Bob

The Maximize event does **not** seem to fire after the user clicks the
MsgBox --- that's the issue... Maybe the event occurs, but it's not
maximizing the form!

This next answer is tricky. The way things are set up, I want the MsgBox to
display "on top of" the form that opened containing this code in its OnOpen
event. So when the MsgBox appears, the CALLING form is still visible, and
the CALLED form's OnOpen event is in control. That's exactly the way I want
it. So now when the user clicks the MsgBox, it goes away and the next
command in the OnOpen event is DoCmd.Maximize --- but the form does not
appear maximized! If I remove the MsgBox event, the form does open
maximized.

I'm trying to warn the user about something, and I want them to see that
warning BEFORE the CALLED form becomes visible. I could place that warning
(the MsgBox event) in the CALLING form (just before I issue the OpenForm
event) but that takes a ton more coding since the content of the message is
data dependent and the CALLING form does not access that data.

Bob.
 
M

Martureo Bob

Followup reply...

I did an additional test and I'm able to get it to work. But I don't know
why!

I created an OnLoad event (since it fires after the OnOpen event) and moved
the Maximize event out of the OnOpen event and into the OnLoad event. The
OnLoad event contains no other code.

Now the form maximizes!

I have no idea why this would work this way (because I have no idea why it
didn't work originally...).

[ By the way, as an additional test I put some "useless" instructions in
between the MsgBox and the Maximize and it made no difference.
Additionally, I tried issuing the Maximize twice, and that also made no
difference. So it seems that the only "solution" is to move the Maximize
completely out of the OnOpen event! ]

Bob.
 

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