Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing form property when opening new form

Status
Not open for further replies.

hblabonte

Programmer
Oct 3, 2001
84
US
This seems like a simple request, but I must be missing something.

I have a main menu form. When a user clicks a cmd button to open a new form (selection from menu), I want the main form to be minimized. When the user closes the selected form, the main menu form should restore.

On the main menu form, I have an event set on the lost focus to minimize, but that never gets executed. I've also played with setting the minimize from within the menu selection "open form" code, but I must have the command off.

Any tips on how to do this?

thanks in advance,
H. Barnes
 
In the OnClick event of button on the main_form:

DoCmd.Minimize
DoCmd.OpenForm "Form2"

In the OnClose event of Form2:

Forms!main_form.SetFocus
DoCmd.Restore

I hope this is what you wanted.

PaulBasel
 
Access's treatment of the MINIMIZE, MAXIMIZE and RESTORE methods is global across all open objects. You're probably better off using the visible property:

sub BtnOpennextForm()
me.Visible = False
DoCmd.OpenForm "NextForm"
End sub

NextForm's CLOSE Button:

Sub BtnClose()
me.Visible = False
Forms!MenuForm.Visible = True
End sub





78.5% of all statistics are made up on the spot.
Another free Access forum:
 
Thanks for the quick replies. Paul's method seems pretty simple and does what I'm looking for. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top