>Hi Gang,
>I have a grid on a form, that I'd like to display
>the sum of a field into a text box on the form
>but outside of the grid. This form has a two table
>ENV. Customer and product. The Customer is the parent
>table, and the product is the child table. The upper
>part of my form handles Customer information, the
>grid (child) displays the product information. What
>I'd like it to do, is display the sum amount of a price
>field into a textbox, and be able to refresh whenever
>I change or update a record.
>
>Can I get any help ?
>
>John
John,
IMHO best done with SQL sum. Normally you update or revert a child grid when you change parent, right (sometimes not-but assume right) ?
Scenario then goes on like this :
-SQL sum each time parent changes and place value in textbox
-Then in any field effecting total add gotfocus-lostfocus code that would just add the difference to textbox.value (textbox.value = textbox.value + (LostfocusValue-GotfocusValue))
This way you prevent performance degrade if you have many child records + you don't cause the rec pointer move that might cause side effects.
Cetin