"Skip" whilst in loop

I have written the following code: If Salesline.find(’-’) then repeat Table.Get(“Primary Key Fields”); variable:= table.field; until SalesLine.Next =0 I have been experiencing problems with this, as if all the criteria of the primary key are not met, then I would get an error (That I was expecting to get). So I added the code: If Salesline.find(’-’) then repeat If (“Primary Key Field 1” = ‘’) or (“Primary key Field 3” = 0) then ??? Table.Get(“Primary Key Fields”); variable:= table.field; until SalesLine.Next =0 What I need to do is replace ??? with some code to “Skip” to the next salesline record. Can anyone help ?

I don’t know if this is what you want your code to do but you could say: If Salesline.find(’-’) then repeat if Table.Get(“Primary Key Fields”) then variable:= table.field; until SalesLine.Next =0 If you use an If…Then statement then the error message should not appear and the repeat loop would continue. I hope this helps. Robin

Or as variant: If Salesline.find(’-’) then repeat If not ((“Primary Key Field 1” = ‘’) or (“Primary key Field 3” = 0)) then begin Table.Get(“Primary Key Fields”); variable:= table.field; end; until SalesLine.Next =0

Many thanks !! I have tried and tested the code as recommended by Robin, and this works great

Dean: Set your primary key fields to notblank then all records will have values. If it is two different tables then Say Serial No. Table for a Sales Line If Salesline.find(’-’)THEN REPEAT IF SerialNo.Get(Salesline.“Document type”,SalesLine.“Document No.”,SalesLine.“Line No.”)Then BEGIN SalesLine.“Serial No.”:= SerialNo.“Serial No.”; Salesline.MODIFY; END; Until SalesLine.Next=0; until SalesLine.Next =0 David Cox MindSource (UK) Limited Navision Solutions Partner Email: david@mindsource.co.uk Web: www.mindsource.co.uk