ACC97: Removing All Pages from Tab Control Removes the Control

ID: Q166844


The information in this article applies to:
  • Microsoft Access 97


SYMPTOMS

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

When you modify a Tab control in Microsoft Access 97, either manually or with Visual Basic for Applications code, if you delete the last page of the Tab control, the control itself is also removed from the form.

This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to the "Building Applications with Microsoft Access 97" manual.


RESOLUTION

If you programmatically remove all pages from a Tab control so that you can rebuild them, after you remove the last page from the control, you can use the CreateControl() function to create a new Tab control with two pages on it. Then you can set the properties for the new control and manipulate its pages.

For more information about using the CreateControl() function, search the Help Index for "CreateControl function."


STATUS

This behavior is by design.


MORE INFORMATION

Steps to Reproduce Behavior

  1. Start Microsoft Access and open the sample database Northwind.mdb.


  2. Create a new form not based on any table or query in Design view.


  3. Click the Tab Control button on the Toolbox toolbar, and then click in the Detail section of the form. A Tab control containing two pages appears on the form.


  4. Set the Name property of the Tab control to axTabCtl.


  5. Save the form as frmTestTab, but do not close the form.


  6. Create a new module and type the following procedure:


  7. 
          Function RemoveTabs(c as TabControl)
             Dim i as Integer
             For i = c.Pages.Count - 1 to 0 Step -1
                c.Pages.Remove
             Next i
          End Function 
  8. Save the module as basTestTab, and then close it.


  9. Press CTRL+G to open the Debug window. Position the Debug window and the frmTestTab form on your screen so that you can see both at the same time.


  10. Type the following line in the Debug window, and then press ENTER.
    ?RemoveTabs(Forms![frmTestTab]![axTabCtl])
    Note that the Tab control is removed from the form.



REFERENCES

For more information about the Tab control, search the Help Index for "tab controls," or ask the Microsoft Access 97 Office Assistant.

Additional query words: clear

Keywords : kbusage FmsOthr
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: October 20, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.