>DODEFAULT() >SELECT SUM(hrs) as total FROM linemarkingbody WITH (buffering=.t.) WHERE linemarkingbody.no=linemarkinghead.no AND required INTO CURSOR tmptotal >IF ISNULL(TMPTOTAL.TOTAL) > REPLACE totalhrs WITH 0 IN linemarkinghead >ELSE > REPLACE totalhrs WITH tmptotal.total IN linemarkinghead >ENDIF >thisform.txtNHours.Refresh >It would be better to do it in InteractiveChange event, but remember to take focus out of the grid before calculating the sum.