hello
I want to make a Button that will change all <Shipping Agent Codes> by <Salesperson Code> in <Customer> Table.
On a Salespeople form I've added a TEXTBOX with "Shipping Agent Codes" SourceEXpr.
for example, When I'll change <Shipping Agent Code> (DHL) to <Salesperson Code> (AH) there will be added a Button "Change", that'll change all (AH) Salespersons with (DHL) Shipping Agent Codes in Customer Table.
I've wrote the following code on
OnPush Trigger
ShippingAgent.SETRANGE(Code);
Salesperson.SETRANGE(Code);
Customer.SETRANGE("Shipping Agent Code");
IF ShippingAgent.FINDFIRST THEN
REPEAT
Salesperson.SETRANGE(Code);
ShippingAgent.SETRANGE(Code);
IF Salesperson.FINDFIRST() THEN
REPEAT
Customer.SETFILTER(Customer."Salesperson Code", Salesperson.Code);
Customer.SETFILTER(Customer."Shipping Agent Code", ShippingAgent.Code);
IF Customer.FINDFIRST() THEN
REPEAT
Customer."Shipping Agent Code" :=ShippingAgent.Code;
Customer.MODIFY;
UNTIL Customer.NEXT = 0;
UNTIL Salesperson.NEXT= 0;
UNTIL ShippingAgent.NEXT =0;
what's wrong with this code,
please someone help me
I'll appriciate it
Answers
This code is changing all "Shipping Agent Code" from Customer table with
"Shipping Agent Codes" from Salespeople table. Put this code to the button's OnPush trigger.
One local variable Customer - Record Table 5200
I hope that this will help You...
see the help online!
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
This code is making it for all SalesPeople:
Why you are using FIND('-') if you just want to know if the table IsEmpty? ;-)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
on salesperson you have the field "Shipping Agent Code". Now, if you change the value in this field on a Salesperson, in all customers, with the same salesperson code, should the "Shipping Agent Code" modified to the new value from sales person card. :?:
1. Your new field has a table realtion to the table "Shipping Agent"
2. now the source behind you button or behind the OnAfterValidate() Trigger of the field "Shipping Agent Code" in table sales person (13)
Thats all.
Regards
It's a very bad habit... Thx Kine
Thank you very much 8)