Share via


Displaying 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 of the list to 3SQL Statement.

  5. Set the RowSource 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

Refreshing a One-to-Many Display Based on a List Value | Adding Pictures to Items in a List | Using Check Boxes | Using Controls | Controls and Objects