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
-
Add a list to the form.
-
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
, andShipped_on
fields in the list, set the ColumnCount property to 3. -
Set the ColumnWidths property to the appropriate widths for displaying your selected fields.
-
Set the RowSourceType Property of the list to 3SQL Statement.
-
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:
В Copy Code SELECT order_id, order_net, shipped_on from orders ; WHERE order.cust_id = customer.cust_id ; INTO CURSOR temp
-
In the Init Event of the form and in the code that moves the record pointer through the table, requery the list:
В Copy Code THISFORM.lstChild.Requery