ACC: Setting Visible Property to False Does Not Hide Form

ID: Q121899


The information in this article applies to:


SYMPTOMS

Novice: Requires knowledge of the user interface on single-user computers.

When you set a form's Visible property to False, the form is not hidden if the Database window is also hidden and the form's OnDeactivate property setting specifies a macro containing the Restore action.


RESOLUTION

To hide the form, either remove the Restore action from the macro specified in the form's OnDeactivate property, or do not hide the Database window.


STATUS

Microsoft has confirmed this to be a problem in Microsoft Access 2.0, 7.0, and 97.


MORE INFORMATION

Steps to Reproduce Problem


  1. Start Microsoft Access and create a new database.


  2. Create the following three new macros:
    
       For Microsoft Access 97:
    
          Macro Name   Macro Action
          -------------------------
          AutoExec     RunCommand
                       OpenForm
          Restore      Restore
          Max          Maximize
    
          AutoExec Actions
          ----------------------
          RunCommand
             Command: WindowHide
          OpenForm
            Form Name: Form1
    
          Restore Actions
          ---------------
          Restore
    
          Max Actions
          -----------
          Maximize
    
        For Microsoft Access version 2.0 and 7.0:
    
          Macro Name   Macro Action
          -------------------------
          AutoExec     DoMenuItem
                       OpenForm
          Restore      Restore
          Max          Maximize
    
          AutoExec Actions
          ----------------
          DoMenuItem
             Menu Bar: Database
             Menu Name: Window
             Command: Hide
          OpenForm
            Form Name: Form1
    
          Restore Actions
          ---------------
          Restore
    
          Max Actions
          -----------
          Maximize 


  3. Create a new, blank form.


  4. Add a command button to the form and set the button's OnClick property to the following event procedure:
    
          Sub Button0_Click ()
          Me.Visible = False
          DoCmd.Openform "Form2"   'Use this line in Microsoft Access 7.0
                                   'and 97
          DoCmd OpenForm "Form2"   'Use this line in Microsoft Access 2.0
          End Sub 


  5. Set the following properties for the form:
    
          OnDeactivate: Restore
          OnActivate: Max 


  6. Save the form as Form1.


  7. Create another new, blank form. Save the new form as Form2.


  8. Close the database and then open it. Note that Form1 is opened automatically.


  9. Click the command button on the form. Note that Form2 is opened, but Form1 is not hidden.



REFERENCES

For more information about macros, search the Help Index for "macros," and then "creating," or ask the Microsoft Access 97 Office Assistant.


Keywords          : FmsProp 
Version           : 2.0 7.0 97
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: April 8, 1999