Hmm.. I changed my code a bit and one line was wrong...
This is the right version:
In the txtSumma.Refresh: (tVerif2 is my grid table)
LOCAL lnRecno
if reccount('tVerif2') > 0
select tVerif2
lnRecno = recno()
sum belopp to this.value &&belopp is my debit/credit field
if lnRecno <= reccount('tVerif2')
goto (lnRecno)
else
go top
endif
endif
>I have solved exactly the same problem with the following code: (except that I have the same field for debit and credit).
>
>In the debit/credit cells LostFocus:
>Thisform.txtSumma.Refresh()
>
>In the txtSumma.Refresh: (tVerif2 is my grid table)
>LOCAL lnRecno
>
>if reccount('tVerif2') > 0
> select tVerif2
> lnRecno = recno()
> sum belopp to this.value &&belopp is my debit/credit field
> if lnRecno <= reccount('tVerif2')
> go top
> else
> goto (lnRecno)
> endif
>endif
>
>This works fine for me... I know that with this procedure I do a lot of code execution, but it dosen't matter becouse it is fast enough so the user never notice it and never get interrupted with his work.
---( Mårten Törnquist )---