Hi Mike,
1) It was my fault in not understanding the whole thing. I had created this summed field in my view 8-0. Thus whenever it changed the form went into edited mode. Thanks to your code wherein there was no replace command and that got me thinking, now I have now removed the summed field from the view and just entering the page now does not put the form in edited mode. My new code for your reference:
<code>DODEFAULT()
LOCAL lnSelect
lnSelect = SELECT()
SELECT SUM(yAmount) AS ySum ; FROM v_sJVDr ; WHERE iPID = v_tJV.iID ; GROUP BY iPID ; INTO CURSOR Temp
THIS.VALUE = Temp.ySum
USE IN Temp
SELECT (lnSelect)</code>
2) I also have the following in the grids amount column valid() method, though the valid fires yet the summed field does not refresh until I save:
<code>DODEFAULT()
THIS.PARENT.PARENT.PARENT.txtYdrtotal.REFRESH()</code>
I have used the object picker for the reference above. Any idea why it doesn't refresh.
3) Now what happens is that as soon as I enter the grid the form goes into edit mode. Click Save then no problem to exit but move around the grid and the form goes into edit mode again. The grid is control sourced by the child view/BO for the form.
This problem is also similar so I will rely on your experience. The child BO/view has a foreign key field iAcctID and the view has 2 fields comming from the accounts master namely cName and cCity. I have a combo in the grid which allows me for selection of the account. The selected accounts cName, cCity and iID from the accounts master are replaced in this child BO. This replacement seems to be triggering the form into edited mode.
What I want to do is to select the account using the combo, save the accounts master iID into the childs iAcctID and the grid to display the cName and cCity from the accounts master. The non current rows in the grid to show their respective accounts master fields. Please help.
Thanks.
<i><font color="#663300"><i><font color="#663300">I have a form with a pageframe and on page1 I have a grid for the child bizobj alls well as far as data entry goes.
Now there is a col in the grid that I want to total, the code in Page1.Refresh() follows: <code> DODEFAULT()
LOCAL lnSelect, lnRecNo, lyTotal
lnSelect = SELECT()
SELECT v_sjvdr lnRecNo = RECNO()
SUM v_sjvdr.yAmount TO lyTotal
GO (lnRecNo)
SELECT v_tjv REPLACE v_tjv.yDrTotal WITH lyTotal This.txtYdrtotal.refresh()
SELECT (lnSelect) <code>
This seem to trigger pointer change. So if I just enter the grid and try to exit out of the form, I get the message to save my changes and at time I get this message twice??
Please advise. </font></i> Hey Bhavbhuti, I have the same thing going on on one of my forms. What I did was to put the code for the sum in the refresh of the text box that displays the sum value. The code goes as follows, basically the same as yours:
LOCAL lnOldArea, lnRecno, lnTotal
DODEFAULT() IF !EMPTY(<field from the view to be summed>) lnOldArea = SELECT() SELECT <viewname> lnRecno = RECNO() CALC SUM((<field from the view to be summed>) TO lnTotal ThisForm.nExtTotal = lnTotal This.Value = lnTotal GO RECORD lnRecno SELECT(lnOldArea) ELSE This.Value = 0 ENDIF
I hope this helps. </font></i>
Regards Bhavbhuti ©2002 Bhavbhuti Nathwani |