CLEAR(RecRef); CLEAR(FieldRef); CLEAR(TBField); RecRef.OPEN(INTTableNo); RecRefHT.OPEN(INTHistTableNo); TBField.SETRANGE(TableNo,INTHistTableNo); IF RecRef.FINDSET(FALSE,FALSE) THEN BEGIN REPEAT RecRefHT.INIT; TFFirstLoop := TRUE; IF TBField.FINDSET(FALSE,FALSE) THEN BEGIN REPEAT FieldRef := RecRef.FIELD(TBField."No."); FieldRefHT := RecRefHT.FIELD(TBField."No."); IF NOT CONFIRM ('a' + FORMAT(FieldRefHT.VALUE) + 'b' + FORMAT(FieldRef.VALUE)) THEN ERROR('a'); FieldRefHT.VALUE := FieldRef.VALUE; TFFirstLoop := FALSE; IF TFFirstLoop THEN BEGIN RecRefHT.INSERT; END ELSE RecRefHT.MODIFY; UNTIL TBField.NEXT = 0; END; UNTIL RecRef.NEXT = 0; END;
Identification fields and values:
List Type='Cylinder Rental List',Code='CR 1',Starting Date='',Package Code='',Business Code=''
Answers
Then you fill up the second primary-key field and do a MODIFY. But the record doesn't exist because you saved it the previous loop.
So copy first ALL fields to your history-record and then do an INSERT. (if your primary key existed of only 1 field, it would work, but VERY slow because you do a MODIFY after each field. Now I don't do MODIFY anymore but only an INSERT.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
you're perfectly right...and believe or not, the code you wrote was the first version of my program...and it didn't work!!
i tried to rewrite it and it worked! :shock:
maybe i putted this IN the loop without noticing it ](*,) ](*,) ](*,) ](*,)
thank you!
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog