Be careful using assignment (:=) to copy Rec to Rec2. This will only copy the values of the fields in Rec to Rec2; it will not copy settings for filters and the current key. Therefore, Rec.NEXT(-1) and Rec2.NEXT(-1) will not necessarily be the same record. It's better to use COPY so that filters and key settings are copied as well.
Answers
General syntax is Rec.NEXT(Steps);
please verify my answer, if it was helpful for you. thanks.
Zohaib Ahmed
Dynamics NAV ERP Technical Consultant.
please like / agree / verify my answer, if it was helpful for you. thanks.
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
EDIT: Oops - @jreynolds is correct, code amended accordingly