MODIFY problem

mmmh i have this simple code: CLEAR(aktVertreiber); aktVertreiber.SETCURRENTKEY(Vertreiber); aktVertreiber.SETRANGE(Vertreiber,‘KORALLE’); IF aktVertreiber.FIND(’-’) THEN REPEAT aktVertreiber.Vertreiber := ‘KORALLE CORETTA’; aktVertreiber.MODIFY; UNTIL aktVertreiber.NEXT = 0; but when it runs it always says that the record doesn’t exist; then it also shows me the identifying field in which it seems that the new value has been written … what is the problem ??? i also tried it with a key which doesn’t contains “vertreiber” but the same end :frowning:

Hi

quote:


Originally posted by pduck
mmmh i have this simple code: CLEAR(aktVertreiber); aktVertreiber.SETCURRENTKEY(Vertreiber); aktVertreiber.SETRANGE(Vertreiber,‘KORALLE’); IF aktVertreiber.FIND(’-’) THEN REPEAT aktVertreiber.Vertreiber := ‘KORALLE CORETTA’; aktVertreiber.MODIFY; UNTIL aktVertreiber.NEXT = 0; but when it runs it always says that the record doesn’t exist; then it also shows me the identifying field in which it seems that the new value has been written … what is the problem ??? i also tried it with a key which doesn’t contains “vertreiber” but the same end :frowning:


You tried to change the key. Please try it with a second record varaible (xRec). This should work. REPEAT xRec.Get(YourRec) xRec.Vertreiber := 'KORALLE CORETTA'; xRec.MODIFY; UNTIL aktVertreiber.NEXT = 0; bye André

I think you should use .RENAME instead of .MODIFY cause aktVertreiber.Vertreiber is Key field. And after you change data in that field it goes out of range you specified and program can’t find it anymore.

cool that works :slight_smile: