>I have a form with a grid on and two tables in a parent child relationship. Each table has its own primary key and the child has a foreign key from the primary table.
>
>By default the grid is displaying the records in the order as I capture them (I assume the primary key of the child table). How can change the grid to display the child records in another order. If I set the order on the child table it makes no difference since there is a link for connecting the tables for the one to many relationship.
>
>If i set the order for the child table in the forms load event to another order then I get an error, since I have code that scans though the table to do calculations and then return the record pointer to the position it was before the calculation. The error is caused since the reset of the pointer to the record before the calculations causes and EOF error with the new order set.
>
>Is there a way to change this order. I want the grid order to be refreshed once I have finished capturing data in the grid. For example there is a date field I have an index on an I want the grid to display records in date order.
>
>Thanks in advance.
The simplest way will be to use select statements for the data, so you don't need child table to be in particular order. Otherwise you will need to use compound index expression where the first part will be the parent key and the rest will be the desired order.
If it's not broken, fix it until it is.
My Blog