Code on OnLookUp

In form X i’ve added a field. This field must be a look up on Form Y (FrmLotNo). I don’t want to use the propertie TableRelation of the new field to open FrmLotNo. Therefore i’ve added the following code on the OnLookUp of the new field: RecLotNo.SETFILTER(RecLotNo.“Item No.”,VarArtikel2); FrmLotNo.SETTABLEVIEW(RecLotNo); FrmLotNo.RUN; RecLotnNo is the table which has FrmLotNo as LookupFormID. When I open the new field everything works great. But when I want to select a record (so the value returns in the new field) this doens’t work. However when I don’t use the code but the TableRelation instead it works. How can I make it work with the code on OnLookUp? Thanks in advance.

Citazione:

In form X i’ve added a field. This field must be a look up on Form Y (FrmLotNo). I don’t want to use the propertie TableRelation of the new field to open FrmLotNo. Therefore i’ve added the following code on the OnLookUp of the new field: RecLotNo.SETFILTER(RecLotNo.“Item No.”,VarArtikel2); FrmLotNo.SETTABLEVIEW(RecLotNo); FrmLotNo.RUN; RecLotnNo is the table which has FrmLotNo as LookupFormID. When I open the new field everything works great. But when I want to select a record (so the value returns in the new field) this doens’t work. However when I don’t use the code but the TableRelation instead it works. How can I make it work with the code on OnLookUp? Thanks in advance.
Originariamente inviato da Henry - 2004 Oct 29 : 10:45:38

IF FORM.RUNMODAL(0,RecLotNo) = ACTION::LookupOK THEN NewField := ... ; The form must have property LookupMode set to Yes Anna

Anna, this works! Thank you very much!

What a coinsidence! Exactly the same thing I was busy with now. I wanted to add “Language ID” and “name” from table “Windows language” (2000000045) to table “Language” (8). Therefore I wanted a lookup-form from table 2000000045. A TableRelation in the properties of the table is not enough, because table 2000000045 hasn’t got a form. So I made a form “Windows Language” and used the code Anna suggested. It works fine. I made these adjustments in Navision 2.6 and I saw in 3.6 that table 8 default has “Language ID” and “name”. Only in 3.6 the lookup doesn’t work! Strange, I think. Sometimes it’s unbelievable what kind of faults/failures Navision has! But I guess every software has that. [;)] Anyway, Henry and Anna, thanks for asking and answering!

Tino, this forum rulez :)!