ACC: How to Use the TabStrip ActiveX Control

ID: Q155646

The information in this article applies to:

SUMMARY

Advanced: Requires expert coding, interoperability, and multiuser skills.

This article shows you how to use the TabStrip ActiveX control in the sample database Northwind to view the Customers and the Suppliers tables using the SourceObject property of a subform.

In Microsoft Access 97, you can use the built-in Tab control on a form to display table data instead of the TabStrip ActiveX control.

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 your version of the "Building Applications with Microsoft Access" manual.

MORE INFORMATION

To use a TabStrip ActiveX control to view the Customers and the Suppliers tables follow these steps:

 1. Open the sample database Northwind.mdb.

 2. Click the Tables tab and highlight the Suppliers table.

 3. On the Insert Menu, click AutoForm to create a form based on the
    Suppliers table.

 4. On the File menu, click Save As/Export.

 5. Save the form as frmSuppliers and close the form.

 6. Repeat steps 2 - 4 for the Customers table.

 7. Save the form as frmCustomers and close the form.

 8. Click the Forms tab and create a blank form in Design view.

 9. On the File menu, click Save As/Export and save the form as
    frmTabStrip.

10. Insert the TabStrip ActiveX control and set its properties as follows:

       Name: ctlTabStrip
       Width: 6
       Height: 3.5

11. Using the right mouse button, click the TabStrip control object, point
    to TabStrip Control Object, and then click Properties on the shortcut
    menu that appears.

12. In the TabStrip Control Properties dialog box, click the Tabs tab.

13. Note that the Index is 1. Type "Customers" (without the quotation

    marks) in the Caption box.

14. Click the Insert Tab button to insert a new Tab.

15. Note that the Index changes to 2. Type "Suppliers" (without the

    quotation marks) in the Caption box.

16. Click OK to close the Property dialog box.

17. Make sure your form is not maximized. If your form is maximized,

    click the button to the left of the File menu, and then click
    Restore on the shortcut menu that appears.

18. Press F11 to bring the Database window to the foreground.

19. Click the Forms tab and drag the frmCustomers form from the Database

    window to the frmTabStrip form (displayed in the background) to
    create a subform.

20. Select and then delete the subform's label.

21. To ensure that the tabs on the TabStrip ActiveX control are not

    covered by the subform, set the subform's properties as follows:

       Top: .3
       Width: 6
       Height: 3
       Left: 0

22. Using the right mouse button, click the TabStrip ActiveX control
    object, and then click Build Event. Type the following event procedure:

       Private Sub ctlTabStrip_Click()
       On Error GoTo errhandler
          Dim rs As Recordset, mybookmark As String, I As Integer

          Select Case Me!ctlTabStrip.SelectedItem.INDEX
             Case 1      ' Show Customers form.
                Customers.SourceObject = "frmCustomers"

             Case 2      ' Show Suppliers form.
                Customers.SourceObject = "frmSuppliers"

          End Select
          Exit Sub

       errhandler:

          MsgBox "There is an error"
           Customers.SourceObject = "frmCustomers"
       End Sub

23. On the Run menu, click Compile Loaded Modules. If there are no
    compile errors save the form.

24. Open the form in Form view.

25. Click the Customers tab to display the frmCustomers form. Click the

    Suppliers tab to display the frmSuppliers tab.

REFERENCES

For more information about the TabStrip ActiveX control, search on "TabStrip Control" using the Microsoft Office 97, Developer Edition help index.

Additional query words: adt

Keywords          : kbprg kbusage FmsHowto 
Version           : 7.0 97
Platform          : WINDOWS
Hardware          : x86
Issue type        : kbhowto

Last Reviewed: November 21, 1998