Share via


How to: Display Child Records in a List

You can display records from a one-to-many relationship in a list so that the list displays the child records in the relationship as the record pointer moves through the parent table.

To display child records in a list

  1. Add a list to the form.

  2. Set the ColumnCount property of the list to the number of columns you want to display.

    For example, if you want to display the Order_id, Order_net, and Shipped_on fields in the list, set the ColumnCount property to 3.

  3. Set the ColumnWidths property to the appropriate widths for displaying your selected fields.

  4. Set the RowSourceType Property of the list to 3 SQL Statement.

  5. Set the RowSource Property to the SELECT statement. For example, the following statement selects three fields from the orders table for the current record in the customer table:

    SELECT order_id, order_net, shipped_on from orders ;
       WHERE order.cust_id = customer.cust_id ;
       INTO CURSOR temp
    
  6. In the Init Event of the form and in the code that moves the record pointer through the table, requery the list:

    THISFORM.lstChild.Requery
    

See Also

Tasks

How to: Use Check Boxes to Specify States

Concepts

Controls for Displaying Lists

Controls and Objects Created in Earlier Versions

Other Resources

Using Controls