>*** is this in the valid ? No this is in form init when buffered records not yet changed (otherwise SQL wouldn't sum() buffered ones. We only need initial sum and count to be computed. >>WITH ThisForm >> .txtEnterTotal.VALUE=iif(_Tally=0,0,arrCompute) >> .txtTotRecCnt.VALUE=_Tally >>ENDWITH >> >*** since there are no ADD/EDIT buttons >*** how do you know when a record has been added or deleted >*** maybe create a method for the init call and use it in >*** the valid also? There is no add or delete buttons right. But 'add' is done when 'dnarrow' at bottom. Grid's deleted (do you allow deletes?) event fires when record is deleted using the leftmost delete mark. >>*Any code adding to table also calls >>WITH ThisForm.txtTotRecCnt >> .VALUE=.Value+1 >>ENDWITH >> >>*Any code deleting from table also calls >>WITH ThisForm.txtTotRecCnt >> .VALUE=.Value-1 >>ENDWITH >>>
>please explain why i would use this.tag? It simply holds the 'old value' that's contributing to current sum. In lost focus we subtract the old value and add new value (thus add only delta of new,old to sum). Textbox.tag is a ready free storage property. >>*TxtAmt.GotFocus >>this.Tag = trans(this.Value) >> >>*TxtAmt.LostFocus >>WITH ThisForm.txtEnterTotal >> .VALUE = .Value + (this.Value - val(this.Tag)) >>ENDWITH >>if !mdown() and inlist(lastkey(),13) >> keyboard '{DNARROW}' >>endif > >*** I had this set to true If is set to true then you don't need append blank. Grid adds new record if at last row + dnarrow is pressed. Checking eof() in a grid is not reliable because grid doesn't let an eof() as refresh fires (I don't mean it never occurs but it positions itself to last one). >>*Grid.AllowAddNew= .t. would handle adding the new record if at bottom >>Cetin