Microsoft KB Archive/121899

= ACC: Setting Visible Property to False Does Not Hide Form =

Article ID: 121899

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 2.0 Standard Edition
 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q121899



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



SYMPTOMS
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.



Steps to Reproduce Problem
 Start Microsoft Access and create a new database.  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  Create a new, blank form.  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   Set the following properties for the form:

<pre class="fixed_text">     OnDeactivate: Restore OnActivate: Max </li> Save the form as Form1.</li> Create another new, blank form. Save the new form as Form2.</li> Close the database and then open it. Note that Form1 is opened automatically.</li> Click the command button on the form. Note that Form2 is opened, but Form1 is not hidden.</li></ol>

<div class="references_section">