OutMat.RESET; OutMat.SETCURRENTKEY("Posting Date","Item No.","Entry Type"); OutMat.SETRANGE(OutMat."Posting Date",StartD,EndD); OutMat.SETRANGE(OutMat."Item No.",'ARG01','ARG99'); OutMat.SETRANGE(OutMat."Entry Type",OutMat."Entry Type"::Output); IF OutMat.FIND('-') THEN BEGIN OutMat.SETCURRENTKEY("Prod. Order No.","Posting Date","Item No.","Entry Type"); //*** OutMat.ASCENDING(TRUE); //***
Answers
You are setting the key after you have gotten the first record from the previous sorting so the pointer may be at the wrong record when you set the 2nd key.
best bet would be to set the ranges and then set the 2nd currentkey before the FINDFIRST (FINDSET)
Albert
Thank you!