Hi, in the purchase order subform i added following code to the lookup trigger of the Item No. field:
IF Type = Type::Item THEN BEGIN
lv_Item.RESET;
lv_Item.SETRANGE(lv_Item."Vendor No.",gv_VendorCode);
IF FORM.RUNMODAL(31,lv_Item) = ACTION::LookupOK THEN BEGIN
VALIDATE("No.",lv_Item."No.");
END;
END;
I fill up the gv_VendorCode like this:
Form - OnAfterGetCurrRecord()
IF "Buy-from Vendor No." <> '' THEN
CurrForm.PurchLines.FORM.SetVendorFilter("Buy-from Vendor No.");
So this makes sure that when i use the lookup i only see the items from that Vendor... When the user press the show all he see's all items.
This works fine but when i try to select an item i get following error:
There is no Item within the filter.
Filters: Vendor No.: '', No.: XXXXXX
XXXXX is the item number that i selected through the lookup...
Anyone knows whats going wrong now?
0
Answers
Marco
Microsoft Certified Trainer
Cronus.it
I dont want to change the lookup functionallity in other forms... Just on the Purchase Form.
Microsoft Certified Trainer
Cronus.it
that when he looks up the item, that first the lookup form only shows the items who have the corresponding Vendor No with
the buy from Vendor no. on the header.
But by pressing show all he should also be able to select items who dont have the Vendor No equally to the Buy from Vendor No.
-after pressing "show all", are you selecting an item for a vendor which is different from the one in the header?
- do you really want this?or you don't want the user to change the filters?
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
The problem was something that i created myself to test:
IF (Type=CONST(" ")) "Standard Text" ELSE IF (Type=CONST(G/L Account)) "G/L Account" ELSE IF (Type=CONST(Item)) Item WHERE (Vendor No.=FIELD(Buy-from Vendor No.)) ELSE IF (Type=CONST(3)) Resource ELSE IF (Type=CONST(Fixed Asset)) "Fixed Asset" ELSE IF (Type=CONST("Charge (Item)")) "Item Charge"
This is the table relation property of the No. field in the Purchase line table.
Putting it back to the original solved the problem
IF (Type=CONST(" ")) "Standard Text" ELSE IF (Type=CONST(G/L Account)) "G/L Account" ELSE IF (Type=CONST(Item)) Item ELSE IF (Type=CONST(3)) Resource ELSE IF (Type=CONST(Fixed Asset)) "Fixed Asset" ELSE IF (Type=CONST("Charge (Item)")) "Item Charge"
This function just fills up a variable inside the subform... Its the gv_VendorCode that it fills up to filter the lookup form.
When users presses "Show all" he is able to select an item which Vendor No. does not equal the Buy From vendor No. on the Header. So standard NAV functionallity.
It works fine now but if you guys have better solution, i'm ready to implement
anyway, why don't you want to use the tbrelation?
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
obviously you can't get it work with TR...
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog