ACC97: Removing All Pages from Tab Control Removes the Control

Last reviewed: August 29, 1997
Article 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:

          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
    
    

  7. Save the module as basTestTab, and then close it.

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

  9. 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 reference words: clear
Keywords : IntpCstm kbusage FmsOthr
Version : 97
Platform : WINDOWS
Hardware : x86
Issue type : kbprb
Solution Type : kbworkaround


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: August 29, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.