>select accounts > > Locate For code=thisform.code.value > opbl = opdr-opcr > > sele student > Set Order To date > Set Filter To > Set Filter To code=thisform.code.value > > Goto Top > Replace balance With 0 All > Goto Top > dfgblnc = opbl > Do While !Eof() > dfgblnc = dfgblnc+debit-credit > Replace balance With dfgblnc > Skip > Enddo >Can you post the structure of the Student table?