Getting an error when running a Codeunit from a form.

When I click the register button the form calls a codeunit and in the codeunit I have some code to insert data into a temp table I made up recWarehouseDocument.

Form=7324 , Codeunit=7303

Navision 5.0 SP1

I hate to use COMMIT as I know it can really mess up the database.

Here is the code:

//DSC-Mod 5-24-11
IF recWarehouseDocument.FINDLAST THEN BEGIN
recWarehouseDocument.WarehouseDocumentNo := WhseJnlLine.“Whse. Document No.”;
recWarehouseDocument.ReasonCode := WhseJnlLine.ReasonDescription;
recWarehouseDocument.INSERT;
END;
//DSC Mod end

Here is the error message:3652.untitled.JPG

Thanks in advance,

Greg

where exactly is that code After or Before the WhseJnlRegisterBatch.RUN(WhseJnlLine); ??

It is right before that line.

Greg

this may sound weired but try to put the Code After if possible

Amr,

I moved it but the message just came up later instead of earlier.

Greg

try to put the code after calling the codeunit in form level

I would put that logic into the codeunit itself, so that you don’t have to use COMMIT.

I put the same code from the codeunit in the form after calling the codeunit and it worked.

Go figure.