change for keys..

Hi guys…

I want change sales person code for particular user…examble,BM,ST,CC,FT this code only change ‘BS’ .I’m using filter function but every thing changes BS…So pls help me particular code change

Can explain clearly?

where you want to change? and what code you have used for this?

Actually i want change table,

salespersionrec.reset;

salespersionrec.SETRANGE(salespersionrec.“No.”,salespersion.“No.”);

salespersionrec.SETFILTER(salespersionrec.code,‘BM|BR|TP’);

IF salespersionrec.FIND(’-’) THEN BEGIN

salespersionrec.code := ‘BS’

salespersionrec.code.MODIFY;

END;

But every thing change BS…remaining code also change BS…

Actually i want change table,

salespersionrec.reset;

salespersionrec.SETRANGE(salespersionrec.“No.”,salespersion.“No.”);

salespersionrec.SETFILTER(salespersionrec.code,‘BM|BR|TP’);

IF salespersionrec.FIND(’-’) THEN BEGIN

salespersionrec.code := ‘BS’

salespersionrec.code.MODIFY;

END;

But every thing change BS…remaining code also change BS…

from where you have run this code?

is this a one time job? then run it from any report.

is salespersionrec it record Salesperson/Purchaser?

I didnt find No. field in this table? is it a custom field?

salespersionrec.code.MODIFY; Is this code compiled?

One, that code will not work because you are only finding the first salesperson that matches your filter and not looping through all of the records.

Two, that code will also not work because you would essentially have three salesperson records with the same code.

There are some topics about merging customer records on the forums. I would search for those and apply that code to your situation.

Hi Pakiya,

I think your trying to modify customer records with salesperson code of BM|BR|TP and trying to replace it with BS salesperson code?

Matt is correct about = One, that code will not work because you are only finding the first salesperson that matches your filter and not looping through all of the records.

Try to use salespersionrec.FINDSET instead then loop the records to using Repeat…Until, specify the correct value and then use

salespersionrec.MODIFY to modify the record.

check also your filtering criteria if you want to modify all records in the customer table…

Hi Pakiya,

I think your trying to modify customer records with salesperson code of BM|BR|TP and trying to replace it with BS salesperson code?

Matt is correct about = One, that code will not work because you are only finding the first salesperson that matches your filter and not looping through all of the records.

Try to use salespersionrec.FINDSET instead then loop the records using Repeat…Until, specify the correct value and then use

salespersionrec.MODIFY to modify the record.

check also your filtering criteria if you want to modify all records in the customer table…