minimize a form

folkie

Registered User.
Local time
Today, 22:27
Joined
May 31, 2002
Messages
43
On my mainform, I have command buttons that open other forms. Is there a way for the mainform to be minimized when one of the other buttons is selected (and opens the new form)?
 
Sure just add this line to the button's event:

DoCmd.Minimize

Make sure you add it before the line that opens the other form otherwise it will open the new form and minimize that one.
 
You guys are good and fast. It worked. I guess I should've also asked how to maximize the mainform after closing the form that I selected from the mainform. I guess there's something like DoCmd.Restore after closing the second form, or something.
 
You're a minute too slow Rob...who needs Broadband :)
 
You guys are good and fast. It worked.

I'm the fastest ;)

I guess I should've also asked how to maximize the mainform after closing the form that I selected from the mainform. I guess there's something like DoCmd.Restore after closing the second form, or something.

Take a wild guess....What's the opposite of Minimize ?
The answer is in your own post!
 
Whoa... just a minute Kevin. You forgot something. ;)

If you set this up in the on close event of the other form, first you have to tell it what to select then maximize.
 
I don't want to maximize the 1st form, but I do want to restore it to the size it was before selecting the 2nd form. I would like it to happen automatically after hitting the X (close button) on the 2nd form. So far that hasn't happened. Should I create a command button on the 2nd form to close it and then open the 1st form (with a restore command)? I'd rather use the X on the form without creating a command button, if that were doable.

I think what Rob said is something I was wondering about.
 
er..yes I knew that but I thought I'd leave that for you to contribute. Split the credit, you know :)

Actually I forgot in my haste :o
 
In the event of the close button:

Docmd.close

Docmd.SelectObject ...

Docmd.Restore
 
I keep getting the error "object doesn't support this property or method" when I close the 2nd form. Originally, both forms had a Border Style of "dialog." I was thinking the Border Style had something to do with the error message so I changed them to Thin and then Sizable, but I still get the error message (with the first form not getting restored after closing the 2nd form).
 
Post the code.

Here's an alterntive to Mini and Maximize

On the main form button that opens the next form put...

Me.Visible=False
INSTEAD of DoCmd.Minimize
Again, put it BEFORE the OpenForm line.

On the OnClick Event of the button that closes the second form, simply put.....

Docmd.OpenForm "FirstFormName"

Or better still put it on the Form's OnClose event in case a user closes with the built in 'Close' on the form (the'X', top right)

Looks neater having it 'invisible' rather than minimized
 
Kevin,

That did it. You're right - invisible is better. I guess Broadband's not all it's cracked up to be.

Thanks again.

~Mark
 

Users who are viewing this thread

Back
Top Bottom