Insert a master/detail control
You can use the master/detail control to link one control to another, so that the selection in the first control determines what appears in the other.
A master/detail control is actually a set of two related controls. One control is the designated master control, and the other is the detail. The master control is always a repeating table. The detail control can be either a repeating table or a repeating section.
Microsoft Office InfoPath 2003 provides a predefined master/detail control that you can insert by using the Controls task pane. You can also create a master/detail control by inserting a repeating table and repeating section (or two repeating tables) and then changing the properties for each control.
Insert a master/detail control (automatically create the data source)
When you insert a master/detail control from the Controls task pane, InfoPath inserts a repeating table and a repeating section that are bound to the same repeating group in the data source. By default, both controls contain other controls, which are bound to fields in that repeating group.
- In design mode, place the insertion point where you want to insert the master/detail control.
- If the Controls task pane is not visible, click More Controls on the Insert menu.
- In the Controls task pane, select the Automatically create data source check box.
- Under Insert controls, click Master/Detail.
- In the Number of columns in master box in the Insert Master/Detail dialog box, enter the number of columns for the master control.
- In the Number of fields in detail box, enter the number of fields for the detail control.
InfoPath inserts two controls on your form. The first is labeled Repeating Table (master), and the second is labeled Repeating Section (detail).
- If you want a label to appear in front of the text boxes in the master control or detail control, type the labels on the form.
- To test the master/detail relationship, click Preview Form on the Standard toolbar, and then enter data in the master control. Related data should appear in the detail control.
Insert a master/detail control (bind to an existing group)
Master and detail controls can be bound to the same repeating group or to different repeating groups, depending on your needs. The controls that appear inside a master/detail control are bound to fields that are part of a repeating group.
- In design mode, place the insertion point where you want to insert the repeating table (the master control).
- If the Controls task pane is not visible, click More Controls on the Insert menu.
- In the Controls task pane, clear the Automatically create data source check box.
- Under Insert controls, click Repeating Table.
- On the first page of the Repeating Table Binding Wizard, click the repeating group that you want to bind the table rows to, and then click Next. If your table has only one column, you can select a repeating field instead of a repeating group. If you want to create a new repeating group to bind the table to, right-click the group to which you want to add the repeating group, click Add on the shortcut menu, and then, in the Add Field or Group dialog box, enter the repeating group's properties.
- To add the columns that you want to include in the table, double-click the fields in the Data binding list.If you want to create a new field to add as a column, right-click the group to which the table is bound, click Add on the shortcut menu, and then, in the Add Field or Group dialog box, enter the field's properties.
- To rearrange the columns, click a column in the Columns in table list, click Move Up or Move Down, and then click Finish.
- Right-click the Repeating Table label below the table on your form, and then click Repeating Table Properties on the shortcut menu.
- On the Master/Detail tab in the Repeating Table Properties dialog box, click Set as master, type a name in the Master ID box, and then click OK.
- Place the insertion point on your form where you want to insert the repeating section (the detail control).
- Under Insert controls, click Repeating Section.
Note If you prefer, you can use another repeating table as the detail control.
- On the first page of the Repeating Section Binding Wizard, click the repeating group that you want to bind the section to, and then click OK.
- Right-click the Repeating Section label that appears below the section on your form, and then click Repeating Section Properties on the shortcut menu.
- On the Master/Detail tab in the Repeating Section Properties dialog box, click Set as detail, and then click the name of the master control in the Link to master ID list.
- To change the default, one-to-one relationship of the master/detail control to a one-to-many relationship, click By key field under Master/detail relationship. Then click Select XPath next to the Key field (master) and Key field (detail) boxes to select the key fields that you want.
- To test the master/detail relationship, click Preview Form on the Standard toolbar, and then enter data in the master control. Related data should appear in the detail control.
Note The information in this topic may not apply if you are working with a form designed using Microsoft Office InfoPath 2003 without the service pack installed. Learn more