ACC2000: How to Use the Tab Control in Access

ID: Q208785


The information in this article applies to:

This article applies to a Microsoft Access database (.mdb) and a Microsoft Access project (.adp).

Novice: Requires knowledge of the user interface on single-user computers.


SUMMARY

This article demonstrates how to use the tab control on a form in Microsoft Access.


MORE INFORMATION

CAUTION: Following the steps in this example will modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and perform these steps on a copy of the database.

A tab control is the easiest and most effective way to create a form with multiple pages or multiple embedded subforms.

With a tab control, you can build separate pages into one control. To switch pages, you click one of the tabs on the control. To see an example of a multi-page form that uses the tab control, open the Employees form (not the Employees (Page Brake) form) in the sample database Northwind.mdb or in NorthwindCS.mdb.

The following steps show you how to create a form with a tab control, where the tab control is a container for multiple subforms. This example uses the sample database Northwind.mdb, but you could do this in the sample Access project NorthwindCS.adp as well:

  1. Open the sample database Northwind.mdb.


  2. Create a new form not based on any table or query in Design View, and name it My Switchboard:


  3. 
       Form: My Switchboard
       --------------------
       Width: 6"
    
       Detail Section:
       Height: 5"
       Label:
       Caption: Switchboard
       Left: 2"
       Top: .5"
       Width: 2"
       Height: .5"
       FontSize: 24 
  4. Click the Tab Control button in the toolbox, and then click somewhere below the label on the form. Microsoft Access adds a tab control with two pages to the form.


  5. Set the following properties for the tab control:


  6. 
       Left: .25"
       Top: 1"
       Width: 5.5"
       Height: 4" 
  7. Right-click the left tab on the tab control, and then click Insert Page on the menu that appears. This adds a third tab to the control.


  8. Click the left tab on the tab control and set its Caption property to Employees.


  9. Click the Subform/Subreport button in the toolbox. If the property sheet is not displayed, on the View menu, click Properties, and then set the AutoLabel property to No.


  10. Press F11 to bring the Database window to the foreground, and position the windows on the screen so that you can see the Employees form in the Database window as well as the tab control on the My Switchboard form.


  11. Drag the Employees form from the Database window to the tab control. The Employees form becomes a subform object on the tab control.


  12. Set the following properties for the new subform object:
    
       Left: 0"
       Top: 1.25"
       Width: 6"
       Height: 4" 
    NOTE: Some of these properties may force a minimum default value. For example, Left may default to a minimum value of .0938".


  13. Click the center tab on the tab control and set its Caption property to Orders.


  14. Repeat steps 8 and 9 with the Orders form.


  15. Set the following properties for the new subform object:
    
       Left: 0"
       Top: 1.25"
       Width: 6"
       Height: 4" 
    NOTE: Some of these properties may force a minimum default value. For example, Left may default to a minimum value of .0938".


  16. Click the right tab on the tab control and set its Caption property to Products.


  17. Repeat steps 8 and 9 with the Products form.


  18. Set the following properties for the new subform object:
    
       Left: 0"
       Top: 1.25"
       Width: 6"
       Height: 4" 
    NOTE: Some of these properties may force a minimum default value. For example, Left may default to a minimum value of .0938".


  19. Click the Subform/Subreport control in the toolbox, and then set its AutoLabel property back to Yes.


  20. Save the form, open it in Form view, and maximize the window. Click the different tabs at the top of the tab control and note that the Employees, Orders, and Products forms are displayed.



REFERENCES

For more information about creating a form with multiple pages or tabs, click Microsoft Access Help on the Help menu, type "tab controls" in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

Additional query words:


Keywords          : kbdta FmsHowto 
Version           : WINDOWS:2000
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: May 13, 1999