ID: Q166844
The information in this article applies to:
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.
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."
This behavior is by design.
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.
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 : kbusage FmsOthr
Version : 97
Platform : WINDOWS
Hardware : x86
Issue type : kbprb
Last Reviewed: November 21, 1998