Select 6 Set Order To code Set Filter To Replace dr With 0 All Replace cr With 0 All Goto Top Do While !Eof() Replace dr With opdr Replace cr With opcr Skip Enddo Select 6 Goto Top Do While !Eof() tcode = code Select 7 Set Order To refno Set Filter To code=tcode and date<=thisform.adate.value AND month=>thisform.monthfm.value and month=<thisform.monthto.value Sum debit To mdr Sum credit To mcr Select 6 Replace dr With dr+mdr Replace cr With cr+mcr Skip Enddo * * Select 6 Set Order To lcode Set Filter To If !thisform.cfname.value=1 Set Filter To code>=thisform.codefm.value and code<=thisform.codeto.value and sec>=thisform.secfm.value and sec<=thisform.secto.value and scode>=thisform.shiftfm.value and scode<=thisform.shiftto.value and lcode>=thisform.levelfm.value and lcode<=thisform.levelto.value and admtd=1 and !dr-cr=0 Endif If thisform.cfname.value=1 Set Filter To code>=thisform.codefm.value and code<=thisform.codeto.value and sec>=thisform.secfm.value and sec<=thisform.secto.value and scode>=thisform.shiftfm.value and scode<=thisform.shiftto.value and lcode>=thisform.levelfm.value and lcode<=thisform.levelto.value and admtd=1 and fname=thisform.fname.value Endif Goto Top Count To c If c>0 Report Form (Alltrim(thisform.file.value)) Preview Do filter Endif If c=0 = Messagebox('Data not found for Selected Critarea', 32, product) Return .T. Endifand your code are here
SELECT student tcode = CODE m.monthfm = THISFORM.monthfm.VALUE m.monthto = THISFORM.monthto.VALUE m.adate = THISFORM.adate.VALUE SELECT SUM(debit), SUM(credit) FROM acctran ; WHERE CODE=tcode AND DATE<= m.adate AND acctran.MONTH BETWEEN m.monthfm AND m.monthto ; INTO ARRAY arTempArray UPDATE student; SET dr = dr+ arTempArray[1], ; cr = cr+ arTempArray[2] ; WHERE student.CODE = tcode RELEASE arTempArraymy work but work is very slow