Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: Disabled Tab Control Page Remains Visible


View products that this article applies to.

This article was previously published under Q208766
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

↑ Back to the top


Symptoms

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 that they contain. However, you cannot change any of the data.

↑ Back to the top


Resolution

To hide the data on a disabled tab control page, use one of the following methods.

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
				

↑ Back to the top


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. If the field list is not displayed, click Field List on the View menu.
  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.

↑ Back to the top


References

For more information about the tab control, click Microsoft Access Help on the Help menu, type tab control in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

↑ Back to the top


Keywords: KB208766, kbprb

↑ Back to the top

Article Info
Article ID : 208766
Revision : 2
Created on : 6/29/2004
Published on : 6/29/2004
Exists online : False
Views : 272