>Hi,
>
>I need help, What I have a form that tracks customer insurance General data (name, address, Phone numbers, etc. etc.). It also has a grid on it, to track insurance coverage amounts. The grid gets its data from a table. Both are linked together Via S.S. Number. What I'm trying to do is display the sum of one of the columns (insurance coverage amount) in a text box on the from, but outside of the grid. The grid table data represents the child table, and the main form is the master table. Can anyone give me sample code of how to do this ?
John,
Keeping a few things in mind :
-Generally when parent rec changes data is updated (IOW child has tableupdated data which could be SQLed)
-Moving rec pointer in child using commands like sum, calculate etc are sometimes dangerous (I mean extra caution is needed)
-Sum only whould change if data contributing to its value changes (Insurance Coverage Amount -ICA field in your case)
It's easy and fast to do.
-Create a custom method (form or grid if that's a subclassed one) to do sum as 'parent' rec changes . It would just SQL sum child and store the value in 'total' textbox
-In ICA field's lostfocus (or valid if you prefer) update the textbox value with 'difference' of new value, old value.
external array mySum
select sum(ICA) from myChild ;
where SSNum = myParent.SSNum ;
into array mySum
thisform.TotalTxtBox.Value = iif(type('mySum[1,1]')='N',mySum[1,1],0)
thisform.TotalTxtBox.Value = ;
thisform.TotalTxtBox.Value - ;
nvl(oldval('ICA','myChild'),0) + ;
nvl(myChild.ICA,0)
Cetin