Creating Tabbed Forms in Access

 

Download the database here: tabbed.mdb

Sometimes you have multiple one-to-many relationships that share the same table:

If one were to make a form to input data into this database, a simple master-detail form won't quite work. Master-detail forms work well if there is only a single master table (the "one" side) and a single detail table (the "many" side). Here, we have multiple detail tables. What we need is a way of displaying multiple detail tables.

Putting each detail table on its own sub-page works very nicely. Each sub-page would be accessible by clicking an exposed tab on the top of each page:

The procedure to create a tabbed form is straightforward. The following procedure is based on the above database:

  1. Using the form wizard, create a simple form that just for the Dept table. The only field you need to display is the Name field as the DeptID field is an Autonumber field.

  2. After the simple Dept form is created, switch to Design view and enlarge it's size. You'll need to drag the "Form Footer" bar downwards to get more room with which to work. Enlarge the form both in width and in height.

  3. The Toolbox should be visible. If it is not, go to the main menu and click on View then Toolbox.

  4. Select the "Tab Control" on the Toolbox (4'th from the bottom).

  5. On the form, left-drag open a dotted box. When the mouse button is released, a tabbed control will fill the space.

  6. Your tabbed control should have two tabs, labelled something like "Page3" and "Page4".

  7. Right-click the name on the tab then select Properties.

  8. The first item under the All tab is Name. Change the name to "Employees".

  9. Repeat the above for the other tab on the tabbed control and change the name to "Projects".

  10. Once both tabs have been renamed, select the Employees tab.

  11. On the toolbar, left-click on the Subform/Subreport control (3'rd from the bottom) to select it.

  12. After you select the Subform/Subreport control, when you hold the mouse over the tabbed control, its interior will turn black. At that point, left-click the mouse. Access will fill that tabbed page with a subform and bring up a wizard.

  13. In the subform wizard, select "Use existing Tables and Queries".

  14. Next, select the Employee table and select the LastName and FirstName fields.

  15. Next, to set the referential links, select "Choose from a list" and "Show Employee for each record in Dept using DeptID".

  16. Change the name of the subform if you wish and Finish.

  17. Resize the subform to fit the tabbed control area better.

  18. Left-click the Projects tab to select that blank sub-page.

  19. Click the Subform/Subreport control on the Toolbox to re-select it.

  20. Hold the mouse over the tabbed control and left-click it to drop a subform on the tabbed control and bring up the wizard.

  21. Once again, in the wizard, select "Use existing Tables and Queries".

  22. Next, select the PRoject table and select the Name field.

  23. Next, once again, select "Choose from a list" and "Show Employee for each record in Dept using DeptID".

  24. Change the name of the subform if you wish and Finish. Resize the subform if necessary.

  25. Done, except for any cosmetic touch-ups desired.