monthfm=thisform.monthfm.value monthto=thisform.monthto.value Select 6 Set Order To code Set Filter To Replace dr With 0 All Replace cr With 0 All *Do While !Eof() LOCATE scan Replace dr With opdr Replace cr With opcr * Skip * Enddo endscan Select 6 LOCATE scan *Do While !Eof() tcode = code Select 7 Set Order To refno Set Filter To code=tcode and date<=thisform.adate.value AND BETWEEN(month,m.monthfm,m.monthto) Sum debit To mdr Sum credit To mcr Select 6 Replace dr With dr+mdr Replace cr With cr+mcr *Skip * Enddo * endscan * 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 locate 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. Endif