Simple Form Command Question

  • Thread starter Thread starter David
  • Start date Start date
D

David

I am trying to perform a simple function and it is driving
me crazy.
I have a MAIN switchboard with buttons to bring up other
forms/sub forms and reports.
Question 1, how do I minimize Main switchboard before
opening the desired form (form2) and when form2 is exited
or closed, restore Main switchboard.
Question 2, my Main switchboard is not Maximized, sized to
about 1/2 of the dimensions of the screen. When I
transition users to a REPORT in preview mode, I want the
mode to be MAXIMIZED so they can see the report easily.
When exiting or closing the report, I want to have the
Main switchboard restored to the original size.
Any assistance you can provide, is very much appreciated.
 
There are a lot of ways. I will suggest one and I imagine
others will also share some different options.

I recommend that you "hide" the main form instead of
minimize it. It is faster and, usually neater. To do so
enter the following code to your command button (or as
many buttons as you want) when you want to make a report
(or form) more visible.

Forms!theNameOfYourSwitchbord.Visible = False

This will hid the Switchboard, but leave it open.
Add the following code to the Close event of the Report:

Forms!theNameOfYourSwitchbord.Visible = True

This will make your Switchboard Visible in its original
size.

Does this help?
 
David said:
I have a MAIN switchboard with buttons to bring up other
forms/sub forms and reports.
Question 1, how do I minimize Main switchboard before
opening the desired form (form2) and when form2 is exited
or closed, restore Main switchboard.


Code behind the button to open the other form:
DoCmd.Minimize
DoCmd.OpenForm . . .

Code in other form's Close event:
Forms!Main.SetFocus
DoCmd.Restore


Question 2, my Main switchboard is not Maximized, sized to
about 1/2 of the dimensions of the screen. When I
transition users to a REPORT in preview mode, I want the
mode to be MAXIMIZED so they can see the report easily.
When exiting or closing the report, I want to have the
Main switchboard restored to the original size.
Any assistance you can provide, is very much appreciated.

Code behind the button th open a report:
DoCmd.OpenReport . . .
DoCmd.Maximize

Code in report's Close event:
DoCmd.Restore
 
Yes it does, thank you.
Is there a way to use the restore command in the module to
restore the the switchboard form to the original 1/2 size
after making it visible?
 
You got some good help with the first problem.

For:
Question 2, my Main switchboard is not Maximized, sized to
about 1/2 of the dimensions of the screen. When I
transition users to a REPORT in preview mode, I want the
mode to be MAXIMIZED so they can see the report easily.

Just simply remove the max/min buttons on the form. That way, if a report is
maxed, then when closed, the calling form WILL NOT inherit the settings. I
mean, if you remove the max/min commands from a form, then it can't be
maxed! You can also accompilish the same thing by setting the forms
proeprity to dialog, but I just in the options turn off the max/min buttions
and the problem is solved.

You then just simply put ONE line of code in the reports on-open event:

docmd.Maximize


This approach thus means you can continue to use your switchboard, not have
to modify existing code, and the ONLY code you add is the above maximize
command.
 
Back
Top