Problem with:"You Cannot make any changes in the database...

easy-navieasy-navi Member Posts: 31
Hello experts,
I have put such a code on OnInitReport() trigger:
StoringLoc.CALCFIELDS(StoringLoc."Item No");
IF StoringLoc.FINDFIRST THEN 
 REPEAT
  StoringLoc."Item No (Normal Field)" := lStoringLoc."Item No"; //StoringLoc."Item No (Normal Field)"  - Is a Normal Field
  StoringLoc.MODIFY;                                                           //lStoringLoc."Item No"  - is a FlowField
UNTIL StoringLoc.NEXT = 0;

And unfortunatlly I get the error:
You Cannot make any changes in the database until a transaction has been started
:(

The goal of that code is to renew the field "Item No (Normal Field)", before the report is run.
I need to have an ItemNo as NORMAL FIELD, not a Flow Field, because later i need to sort that raport by an ItemNo.
Any idea, please?

p.s.
Nav 4.03. Ms Sql 2005
http://www.reinwestuj.pl Inwestuj w nieruchomości. Condohotele, aparthotele.

Comments

  • MBergerMBerger Member Posts: 413
    OnInitReport is run before anything happens in the report, even before you get to see the requetform ( if any ). Maybe you should move the code to the OnPreReport trigger, or move the code outside of the report and call it before you open it.
  • easy-navieasy-navi Member Posts: 31
    I moved that code to the section OnPreReport. And now it work. Thanks.
    p.s.
    I had the problem with Calcfields. I found that it works only when the Calcfields is inside the loop:
    IF lStoringLoc.FINDFIRST THEN
    REPEAT
      lStoringLoc.CALCFIELDS(lStoringLoc."Lot Description3");
      lStoringLoc."Lot Description3(Normal Field)" := lStoringLoc."Lot Description3";
      lStoringLoc.MODIFY;
    UNTIL lStoringLoc.NEXT = 0;
    
    http://www.reinwestuj.pl Inwestuj w nieruchomości. Condohotele, aparthotele.
Sign In or Register to comment.