ACC97: Disabled Tab Control Page Remains Visible

Last reviewed: July 21, 1997
Article ID: Q161011
The information in this article applies to:
  • Microsoft Access 97

SYMPTOMS

Moderate: Requires basic macro, coding, and interoperability skills.

When the Enabled property of a page on a Tab control is set to False, you can still click the tab and see its controls and the data they contain. However, you cannot change any of the data.

RESOLUTION

There are two methods you can use to hide the data on a disabled Tab control page.

Method 1

Set the Visible property of the Tab control page to False in the Load event of the form. This makes the Tab control page and its tab invisible. Add the following procedure to the Load event of the form, substituting the name of your own Tab control:

   Private Sub Form_Load()
      If Me!TabCtl0.Pages(1).Enabled = False Then
         Me!TabCtl0.Pages(1).Visible = False
      End If
   End Sub

Method 2

Set the Visible properties of the controls on the Tab control page to False in the Load event of the form. This hides the controls on that page, but allows the tab to remain visible. Add the following procedure to the Load event of the form, substituting the name of your own Tab control and page controls:

   Private Sub Form_Load()
     If Me!Tabctl0.Pages(1).Enabled = False Then
        Me!TabCtl0.Pages(1).Controls![HireDate].Visible = False
        Me!TabCtl0.Pages(1).Controls![ReportsTo].Visible = False
     End If
   End Sub

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Open the sample database Northwind.mdb, and create a new blank form based on the Employees table.

  2. Add a Tab control to the form.

  3. On the View menu, click Field List to display a list of available fields for the form.

  4. Click the Page 1 tab on the Tab control, and drag the EmployeeID, FirstName and LastName fields from the field list to the Tab control.

  5. Click the Page 2 tab on the Tab control, and drag the HireDate and ReportsTo fields from the field list to the Tab control.

  6. Set the Enabled property of the Page 2 tab to No.

  7. Save the form as frmTabCtl and close it.

  8. Open the frmTabCtl form in Form view.

  9. Click the Page 2 tab. Note that you can see the HireDate and ReportsTo fields, but you cannot change them.

REFERENCES

For more information about the tab control, search the Help Index for "tab controls."


Additional query words: grey gray dim
Keywords : FmsOthr
Version : 97
Platform : WINDOWS
Hardware : X86
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 21, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.