Microsoft KB Archive/324582

= How to use the Tab control with linked subforms in Access 2002 =

Article ID: 324582

Article Last Modified on 8/2/2004

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q324582



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

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

For a Microsoft Access 2000 version of this article, see 198502.

IN THIS TASK
SUMMARY
 * Example of How to Use the Tab Control with Linked Subforms



SUMMARY
You can use the tab control to display linked subforms. A form contains linked subforms when the second subform displays only the records related to the record that you select in the first subform. The Customer Orders form in the sample database Northwind.mdb has an example of linked subforms.

You can use a tab control to put different controls on different pages of a single control. By using a tab control, you can make better use of available space on the main form and still have plenty of space to display the subforms. back to the top

Example of How to Use the Tab Control with Linked Subforms
The following example demonstrates how to create a form that has two linked subforms similar to those on the Customer Orders form. The tab control on the main form contains one of the linked subforms on each of its two pages.  Open the sample database Northwind.mdb. Create a new form in Design view. Base the form on the Customers table. Save the form as frmMain. If the field list is not visible, click Field List on the View menu. Drag the CustomerID field to the upper-left corner of the detail section, and then drag the CompanyName field to the upper-right corner of the detail section. Click Tab Control in the toolbox, and then click under the CustomerID field in the detail section of the form to create the tab control.  Set the following properties for the tab control:   Left:    0&quot; Top:    0.25&quot; Width:  6&quot; Height: 3&quot; </li> Click the leftmost tab of the control. On the View menu, click Properties. Change the name of the page to Orders .</li> Click Subform/Subreport in the toolbox.</li> Move your pointer over the body of the Orders page. Note that the page changes color. This makes sure that you are placing the subform on that page instead of laying it on top of the tab control. Click to add a subform to the page.</li> On the first page of the Subform/Subreport Wizard, click Forms, and then click Customer Orders Subform1 in the list. Click Next.</li> When you are prompted if you want to define which fields link your main form to this subform, click Choose from a list, and then click Show Orders for each record in Customers using CustomerID. Click Finish.</li>  On the View menu, click Properties. Set the following properties: <pre class="fixed_text">  Left:     0.5&quot; Top:     0.75&quot; Width:   3.5&quot; Height:  1.5&quot; </li> Click the rightmost tab of the control. On the View menu, click Properties. Change the name of the page to Order Details .</li> Click Subform/Subreport in the toolbox.</li> Move your pointer over the body of the Orders Details page. Note that the page changes color. Click to add a subform to the page.</li> On the first page of the Subform/Subreport Wizard, click Forms, and then click Customer Orders Subform2 in the list. Click Finish.</li>  On the View menu, click Properties. Set the following properties: <pre class="fixed_text">  LinkChildFields:  OrderID LinkMasterFields: [Customer Orders Subform1].[Form]![OrderID] Left:            0.5&quot; Top:             0.75&quot; Width:           5.5&quot; Height:          1.5&quot; </li> On the View menu, click Form View.

Note that as you select different Order IDs on the Orders page, only the products for that particular order are displayed on the Order Details page.</li></ol>

back to the top

Additional query words: inf acc2002

Keywords: kbhowto kbprogramming KB324582

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.