Stepping backwards

I make a ‘find’ to get the last sales shipment line of a customer. Than I want to step backwards to find the last but one shipping by date. Looking into the help for next (NF 2.60), I don’t know, how to use repeat … until to step backwards. Has someone a hint? Michael

Hi Michael, this code runs backwards through all the records. If Rec.FIND(’+’) then REPEAT … UNTIL Rec.NEXT(-1) = 0; If you only the last but one record then Rec.FIND(’+’); Rec.NEXT(-1); Saludos Nils

Nils, You’re right, except that your suggestion will give a runtime error, if there as no records in the table you are searching in. To prevent that simply changes the line from



IF Rec.FIND('+') THEN;

Best regards, Erik P. Ernst, webmaster

…you got me there Thanks for the hint. Nils

Thanks both for the hints. Michael