Creating a master/detail form

The following steps and screens show how to create a master/detail one-to-many or master/detail many-to-one form.

StepsTo create a master/detail one-to-many or master/detail many-to-one form:

  1. Click the New button in the PowerBar.

    The New dialog box displays.

  2. Select the Object tab, the Form icon, and click OK.

    The New Form dialog box displays.

  3. Select Quick Select and either of the master/detail styles, then click OK.

    The Select Master Table dialog box displays.

  4. Select the master table.

    For a master/detail one-to-many form, this is the table whose data displays one row at a time at the top of the form. For a master/detail many-to-one form, this is the table whose data displays in a list at the top of the form. In the example, it is the Department table.

  5. Select some or all of the columns in the master table, then click OK:

    Shown is the Select Master Table dialog box. At top are instructions to click on a table, select one or more columns, enter optional sorting and selection criteria, and right click to display comments. Below this are a scrollable display at left labeled Tables with the department table highlighted and at right ia display labeled Columns displaying a list of columns for the selected table. Next is a blank Comments area, and at bottom is a grid with rows labeled Column, Sort, Criteria, and Or. Each column in the grid shows the name of one column from the selected table.

    The Select Detail Table dialog box displays.

  6. Select the detail table.

    This is the table that is related to the master table and whose data displays at the bottom of the form. For a master/detail one-to-many form, the data displays many rows at a time. For a master/detail many-to-one form, the data displays one row at a time. In the example, it is the Employee table.

  7. Select some or all of the columns in the detail table, then click OK.

    The Select Master/Detail Relationship dialog box displays. It lists primary/foreign key relationships between the master and detail tables:

    Shown is the Select Master/Detail Relationship dialog box . It instructs the user to select a primary / foreign key that relates the master data to the detail data or to select the More >> button to choose from all possible relationships. Below this is a scrollable display area labeled Primary / Foreign Keys: displaying the entry department > employee.
  8. Specify the relationship between the master and detail tables.

    To do this, you identify which column or columns in the detail table have the same values as the column or columns in the master table.

    InfoMaker needs this information so that it knows which detail rows to display when you display a row in the master table.

    When the master table and the detail table are the same table, the complete Select Master/Detail Relationship dialog box displays automatically and you specify the relationship:

    Shown is the SElect Master / Detail RElationship dialog box with all the same information as in the previous illustration, but with areas lableled From Column and To Column at bottom. Each has four drop downs for specifying key relationships.

    InfoMaker generates the basic form and displays it in the Form painter workspace. The following illustration shows a master/detail one-to-many form:

    Shown is a master/detail one-to-many form. At top are fields labeled Department I D, Department Name, and Manager I D. At bottom is a grid showing employee I D, Manager I D, First Name, Last Name, Department I D, and Street. All the fields show the names of the table columns whose data will be displayed there in the actual form.
  9. Size the master area if necessary and click the Run button to run the form.

    When you run the form, the form displays with data:

    Shown is a master/detail one-to-many form. At top are fields labeled Department I D, Department Name, and Manager I D. At bottom is a grid showing employee I D, Manager I D, First Name, Last Name, Department I D, and Street. All the fields show actual data.

At this point, you can enhance the form. To do so, you first click the Close button to return to the Form painter Layout view.

For information about how to enhance the form, see Chapter 20, “Enhancing Forms”.