I have a table with only two fields (Field1 and Field2). Both fields are part of primary Key. When i try to modify one of these fields system shows an error because cannot find the record to modify.
This is the code:
recRelation.SETFILTER("Field1",'%1',lrecDoc."Nr.");
IF recRelation.FIND('-') THEN
REPEAT
recRelation."Field1" := lrecoDocRec."Nr.";
recRelation.MODIFY; // Here it's breaks code execution and shows an error
UNTIL recRelation.NEXT = 0;
How I solve this problem?
Comments
delete the record and insert the new one (here you'll have to change manually the table relations). You cannot use MODIFY.
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
where "Value" are the PK field values.
But don't use rename in a loop on the same Record variable. Use here a second record variable and rename there.
like:
Regards
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book