Update Form after print

Hello together,

I have a small problem with a form. I hope someone can help me?!

That’s what I do:

Open a Form like “Purchase Orders” and print the purchase.

The report modified the record and counts a value higher (“no. of prints”).

The record is modified, but at the form the old value is still displayed.

What can I do to refresh the form?

  • CurrForm.UPDATECONTROLS or CurrForm.UPDATE at the print button has brought nothing.

Any ideas?

Thanks!

Wel;come to DUG.

Which version are you using?

Is it standatd form or customized?

I tested in NAV2009R2 and Form is update with correctly once it is printed in standard database.

Hi,

thanks for your fast response!

I’m using NAV2009R2.

Yes, but that was an example.

I want the same for our “Production Order”.

I have extended the table and add the fields to the form “Planned Production Order”.

After the print of the working papers, the counter in the form have still the old value.

What’s different to Purchase?

Where did you write code? Did you use Codeunit as in Purchase?

the selection of the report in a codeunit, the calling on the push button on the form and modify the record by the report.

the selection of the report in a codeunit, the calling over the push button on the form and modify the record by the report.

Did you check CU317 in standard database how Purchase is printed and counted?

Yes, i use the same code.

only for “production order”, but not in a new CU.

I placed the code directly in the report.

Did you try by moving it to Codeunit?

Yes, I’ve tried it.

I’ve called a funtion in a CU, but the result was the same.

Can you show us the code you written for all this requirement?

//“Production Order” - Form

- OnPush() //Print button

ManuPrintReport.PrintProductionOrder(Rec,0); //CU “Manu. Print Report”


//CU “Manu. Print Report”

Find the right report…

Call the report

//Report

First Data Item “Production Order”

Production Order - OnPostDataItem()

IF NOT CurrReport.PREVIEW THEN BEGIN

uARCEinr.GET;

IF UPPERCASE(USERID) <> uARCEinr.“Archiv User ID” THEN

BEGIN

FIND;

“No. Printed” := “No. Printed” + 1;

“Printed By” := UPPERCASE(USERID);

“Date Printed” := CURRENTDATETIME;

MODIFY;

COMMIT;

END;

END;

Did you check whether the code under IF UPPERCASE(USERID) <> uARCEinr.“Archiv User ID” THEN is executing?

simply add any message and try.

Is your report printing right production order?

Yes, the report is printing right. After this, the record is modified.

When I switch the focus, the form update right. The new values are displayed.

So Andreas does this mean you have solved your problem?

Hello Erik,

not really!

But the problem is solved, because I call in this Action 2 reports on.

The focus change and my form updates itself by itself.

The original problem remains unsolved.

Hi Andreas,

After this line in the code:

Try to insert: CurrForm.UPDATE;

Hi Erik,

I have already tried. It’s the wrong time.

The report request form is open but the request is not printed.

In the same time the line “CurrFor.UPDATE” run.

The problem is, that in this moment the record is not changed yet.

The update-command must happen later.

What do you exactly mean? If the report request form is still open, then it means that report has not yet been printed and your CurrForm.UPDATE has not been run yet.

May I suggest that you enables the debugger and check exactly which code lines are being executed when?