RunModal Form Error

Martin4310Martin4310 Member Posts: 3
Hello, I try to use a form to display some Results of search with a special form. I try to use this form with Runmodal...
I create the values in the Table bfPOTracking and will display this values in the new form Trackform. But I get the error:

Form.Runmodal() ist nicht erlaubt in Schreibtransaktionen....

Source:

bfLOT.RESET;
bfLOT.SETRANGE("Item No.",POCallLine.Itemno);
bfPOTracking.RESET;
REPEAT
bfPOTracking.ItemNo:=POCallLine.Itemno;
bfPOTracking.PONo:=POCallLine.PONo;
bfPOTracking.LotNo:=bfLOT."Lot No.";
bfPOTracking.Quantity:=bfLOT.Quantity;
bfPOTracking."Trading Unit No":=bfLOT."Trading Unit Number";
bfPOTracking."Req. Quantity":=POCallLine.QuantityTotal;
IF bfLOT.Quantity<>0 THEN
bfPOTracking.INSERT;
UNTIL bfLOT.NEXT=0;


CLEAR(TrackForm);
TrackForm.SETTABLEVIEW(bfPOTracking);
TrackForm.SETRECORD(bfPOTracking);
if TrackForm.RUNModal=LookupOK Then Begin
.....some functions
End;

Comments

  • kinekine Member Posts: 12,562
    If the table into which you are inserting is not temporary, you need to commit the changes before FORM.RUNMODAL is called. As the error described, you cannot run form as modal if there is writing transaction in progress.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • garakgarak Member Posts: 3,263
    during a write transaction (and this because the insert) you can't run a form in runmodalmode. the runmodalmode stops the transaction for an user interaction and this would create blockes.
    So if you only need the datas to display use the table temporary or if your transaction is really finished use commit, but doen't create "half" datas or fill your table from a function of you called form.

    regards
    Do you make it right, it works too!
  • Martin4310Martin4310 Member Posts: 3
    Even if I fill this table before I get this message. And what means "use this table temporary"?
  • kinekine Member Posts: 12,562
    Martin4310 wrote:
    Even if I fill this table before I get this message. And what means "use this table temporary"?

    It means, that the variable of type record is marked as "Temporary" (see properties of the variable). In this case, what you write into this "temporary" table, is done only on client, and the changes are not transfered into DB server. It means no write transaction on server, thus you can run form over this as modal without need for COMMIT. If you want to know more about temporary tables, I recommend to read some documentation/manuals etc.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.