Maximising main form using DoCmd

  • Thread starter Thread starter Phred Bear
  • Start date Start date
P

Phred Bear

I'v stumbled across a problem with maximising forms. It seems that if you
use 'DoCmd.Maximize' to size a form, all subsequent forms remain maximized
until you pass a 'Restore' command, which I don't want to do otherwise the
main form will re-size.

I want my main form to open and fill the screen and stay that way whilst
other minor forms open and close on top of it in different parts of the
screen at different times. They open and close independantly of each other
so I am unable to make them pop-up or Model forms because they will always
stay on top and hogg the screen.

In Delphi, this is easily accomplished because you can size each form
induvidually in code.

Anybody know a way around this?
 
Phred Bear said:
I'v stumbled across a problem with maximising forms. It seems that if
you use 'DoCmd.Maximize' to size a form, all subsequent forms remain
maximized until you pass a 'Restore' command, which I don't want to
do otherwise the main form will re-size.

I want my main form to open and fill the screen and stay that way
whilst other minor forms open and close on top of it in different
parts of the screen at different times. They open and close
independantly of each other so I am unable to make them pop-up or
Model forms because they will always stay on top and hogg the screen.

In Delphi, this is easily accomplished because you can size each form
induvidually in code.

Anybody know a way around this?

Terry Kreft has posted code on the Access Web to resize a form to fill
the Access window without really maximizing it. Here's the link:

http://www.mvps.org/access/api/api0022.htm
API: Remove Close button from maximized forms

(This is also a way to keep the "close" button from reappearing on a
form when the form is maximized; hence the title.)
 
<< Terry Kreft has posted code on the Access Web to resize a form to fill
the Access window without really maximizing it. Here's the link:

http://www.mvps.org/access/api/api0022.htm
API: Remove Close button from maximized forms>>

Dirk, Thanks for that.

I don't really understand API's much and I can't get it to run. I am trying
to execute it in my main form, FmMain, Open Event with variations on
MaximizeRestoredForm('FmMain'), ...(Form.FmMain) et al but I just seem to be
working through the Errors Number list.
I am using it in Access 2000. Can you give me a steer please.

Many thanks
 
Phred Bear said:
<< Terry Kreft has posted code on the Access Web to resize a form to
fill the Access window without really maximizing it. Here's the
link:

http://www.mvps.org/access/api/api0022.htm
API: Remove Close button from maximized forms>>

Dirk, Thanks for that.

I don't really understand API's much and I can't get it to run. I am
trying to execute it in my main form, FmMain, Open Event with
variations on MaximizeRestoredForm('FmMain'), ...(Form.FmMain) et al
but I just seem to be working through the Errors Number list.
I am using it in Access 2000. Can you give me a steer please.

Many thanks

Assuming you've correctly saved the code from the web page into a
standard module, all you need it this code in your form's Open event:

'----- start of code -----
Private Sub Form_Open(Cancel As Integer)

MaximizeRestoredForm Me

End Sub

'----- end of code -----

If that doesn't work, you probably made a mistake in creating the
module.
 
<< Assuming you've correctly saved the code from the web page into a
standard module, all you need it this code in your form's Open event:

'----- start of code -----
Private Sub Form_Open(Cancel As Integer)

MaximizeRestoredForm Me

End Sub

'----- end of code -----

If that doesn't work, you probably made a mistake in creating the
module.>>

Ahaaaa. That's the one permutation I hadn't tried. It works fine. Thanks
again.

Ian Millward
Edinburgh
 
Back
Top