CLOSE ALL && Bad Idea to close everything, but not the cause of your current problems SET SAFETY off USE aliq1 SELECT 0 USE aliq EXCL INDEX ON no TAG no FOR i = 1 TO 14 && assume 20 values for flag SEEK i COPY TO temp1 NEXT (thisform.text1.Value) WHILE no = i IF thisform.text1.Value<i thisform.text2.Value=thisform.text1.Value-i SELECT aliq1 APPEND FROM temp1 thisform.text1.Value=thisform.text1.Value+thisform.text2.Value SELECT aliq endif NEXTthanks.