ACC: How to Use the TabStrip ActiveX Control

ID: Q155646


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


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 through 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:


  11. Name: ctlTabStrip
    Width: 6
    Height: 3.5
  12. 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.


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


  14. Note that the Index is 1. Type "Customers" (without the quotation marks) in the Caption box.


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


  16. Note that the Index changes to 2. Type "Suppliers" (without the quotation marks) in the Caption box.


  17. Click OK to close the Property dialog box.


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


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


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


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


  22. To ensure that the tabs on the TabStrip ActiveX control are not covered by the subform, set the subform's properties as follows:


  23. Top: .3
    Width: 6
    Height: 3
    Left: 0
  24. Using the right mouse button, click the TabStrip ActiveX control object, and then click Build Event. Type the following event procedure:


  25. 
           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 
  26. On the Run menu, click Compile Loaded Modules. If there are no compile errors save the form.


  27. Open the form in Form view.


  28. 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 : WINDOWS:7.0,97
Platform : WINDOWS
Issue type : kbhowto


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