TableRelation property

Hi All, I am new to Navision. I write the following code in Form-OnNewRecord trigger SalesPurchase := v_SalesPurchase; “Contract No” := v_ContractNo; CustVendNo := v_CustVendNo; type of CustVendNo field is Option (Sales/Purchase). The TableRelation property of CustVendNo field is “IF (SalesPurchase=CONST(Purchase)) Vendor.No. ELSE IF (SalesPurchase=CONST(Sales)) Customer.No.” when SalesPurchase is Sales there is no problem, but when SalesPurchase is Purchase system says “There isnt Customer no ‘Vendxxxx’” system must check Vendor table but checks Customer table. I set data in v_SalesPurchase variable with function. Regards.

Assuming that we are dealing with a table, do you have a filter set on SalesPurchase?

quote:


Originally posted by David Cox
Assuming that we are dealing with a table, do you have a filter set on SalesPurchase?


No. I call this form from Purchases&Payables and Sales&Receivables modul. I use the following function in form for setting v_SalesPurchase to Sales or Purchase. SetParameterForContract(p_Contractno : Code[10];p_CustVendNo : Code[10];p_SalesPurchase : ‘Sales,Purchase’) //Alpay Kuru-Omni 21.08.2004 v_CustVendNo := p_CustVendNo; v_SalesPurchase := p_SalesPurchase; v_ContractNo := p_Contractno; I use the following code for calling this form from moduls frmForm2.SetParameterForContract(“Contract No”,“vendor/customer no”,SalesPurchase); frmForm2.RUN; Thanks