I tested the first section of code (table) and it seems to work fine on my DB.
I created a table with 2 test fields:
Enabled Field No. Field Name Data Type
Yes 10 Table ID Integer
Yes 20 Field ID Integer
I created 2 forms.
First one for the lookup to the "Object" table
Second is the form for the table created above.
Back to my table:
Created global:
Name DataType Subtype
Obj Record Object
Then went to OnLookup() of the "Table ID" field:
Table ID - OnLookup()
Obj.SETRANGE(Obj.Type,Obj.Type::Table);
IF FORM.RUNMODAL(54997,Obj)=ACTION::LookupOK THEN BEGIN
VALIDATE("Table ID",Obj.ID);
END;
If you still cannot sort this, send me the objects in a PM with the version your running, and ill gladly look at them.
In this way, there is a connection between the RUNMODAL and the form you want to run. If you use 54997, it is just an integer. If later you need to renumber some objects, it becomes a lot easier.
Little trick to change your code fast:
FORM.RUNMODAL("54997",Obj)
When you save+compile and close and then reopen your object, Navision will have changed "54997" in "My Form".
Regards,Alain Krikilion No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I do it myself.... i don't create form for my table ](*,)
My fault.. :oops:
you have to create forms yourself and then calls these forms in the code.
you'll see from the time of my post that it was a little late :oops:
this time i'll ask first.........
Have you now sorted this ? if not, post your code
Code:
Table ID-Lookup
Obj.SETRANGE(Obj.Type,Obj.Type::Table);
IF FORM.RUNMODAL(54997,Obj)=ACTION::LookupOK THEN BEGIN
VALIDATE("Table No.",Obj.ID);
END;
Field ID-Lookup
Fld.SETRANGE(Fld.TableNo,"Table No.");
IF FORM.RUNMODAL(54990,Fld)=ACTION::LookupOK THEN BEGIN
VALIDATE("Field No.",Fld."No.");
END;
I don't need sort this table
I tested the first section of code (table) and it seems to work fine on my DB.
I created a table with 2 test fields:
Enabled Field No. Field Name Data Type
Yes 10 Table ID Integer
Yes 20 Field ID Integer
I created 2 forms.
First one for the lookup to the "Object" table
Second is the form for the table created above.
Back to my table:
Created global:
Name DataType Subtype
Obj Record Object
Then went to OnLookup() of the "Table ID" field:
Table ID - OnLookup()
Obj.SETRANGE(Obj.Type,Obj.Type::Table);
IF FORM.RUNMODAL(54997,Obj)=ACTION::LookupOK THEN BEGIN
VALIDATE("Table ID",Obj.ID);
END;
If you still cannot sort this, send me the objects in a PM with the version your running, and ill gladly look at them.
But rather use : In this way, there is a connection between the RUNMODAL and the form you want to run. If you use 54997, it is just an integer. If later you need to renumber some objects, it becomes a lot easier.
Little trick to change your code fast: When you save+compile and close and then reopen your object, Navision will have changed "54997" in "My Form".
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I solve it already