ACC1x: Hidden Subform Maximized If Main Form Is Maximized

ID: Q99935


The information in this article applies to:


SYMPTOMS

In a main/subform combination where the main form is maximized and the subform is hidden, the subform returns maximized when it is made visible. This results in covering the entire main form.


RESOLUTION

Because the Visible property is usually changed through a macro or function, work around this problem by adding steps to the process to restore the main form before the subform is made visible. Then, maximize the main form. An example of this workaround is detailed after the "Steps to Reproduce Problem" section below.


STATUS

This problem no longer occurs in Microsoft Access version 2.0.


MORE INFORMATION

You can reproduce this problem by using the Orders form in the NWIND.MDB sample database. The following steps detail the macros necessary to reproduce this problem. The resolution to this sample problem is listed after the steps.

Steps to Reproduce Problem


  1. Create a macro group that contains two macros. Name one "Hidden" and the other "Visible."
    
          Macro Name         Action
          ---------------------------
          Hidden             Setvalue
          Visible            Setvalue
    
          Hidden Macro Actions
          --------------------
          Setvalue
             Item: Forms![orders]![orders subform].Form.Visible
             Expression: 0
    
          Visible Macro Actions
          ---------------------
          Setvalue
             Item: Forms![orders]![orders subform].Form.Visible
             Expression: -1 


  2. Close and save the macro as "Show."


  3. Open the Orders form and add two command buttons.


  4. Set the following properties on the command buttons:
    
         Command Button: Button1
            Caption: Hide
            OnPush:  Show.Hidden
    
         Command Button: Button2
            Caption: Show
            OnPush:  Show.Visible 


  5. Choose View, then choose Form to open the Orders Form in Form view.


  6. Maximize the Orders form by using the Maximize button in the forms upper-right corner.


  7. Choose the Hide button to hide the subform.


  8. Choose the Show button to show the subform maximized.


The main form is no longer visible.

To workaround this problem, change the Visible macro actions as follows:

   Visible Macro Actions
   ---------------------
   Echo
      Echo On: No
   Restore
   Setvalue
      Item: Forms![orders]![orders subform].Form.Visible
      Expression: -1
   Maximize
   Echo
      Echo On: Yes 


REFERENCES

Microsoft Access "User's Guide," Chapter 22, "Using Macros with Forms"


Keywords          : kbusage FmsSubf 
Version           : 1.0 1.1
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: March 23, 1999