Hot to get the Record Position in a Table?

hi, has anybody a well working solution for getting the position of a record in a table ? my problem is that i have a form with a subform and the subform shows its items using a setrange() cause a tablerelation is not useable … i also want to know the absolute position of the record in the table … something like 3 of 10 you know … (one of my last “solutions”) i think its important to say that the form has got a setrange before … i:=0; aktArtnr := Rec.Artnr; IF COUNT > 0 THEN IF FIND(’-’) THEN REPEAT IF Artnr = aktArtnr THEN nr:=i+1; i:=i+1; UNTIL (NEXT=0) OR (i>0) ELSE nr := 0; but it doesn’t really work … it tries to add a new record and some other failures … so if anybody has a good idea then tell me … thx alex *** quack ***

Hi Alex, to get the position of the record on the form try the following:

**PositionOfRecord() ExitValue : Integer**
Rec2.COPY(Rec);
ExitValue := 1;
WHILE Rec2.NEXT(-1) <> 0 DO
  ExitValue += 1;

If you want the absolute position in the table:

**PositionOfRecord() ExitValue : Integer**
Rec2 := Rec;
ExitValue := 1;
WHILE Rec2.NEXT(-1) <> 0 DO
  ExitValue += 1;

Regards, Reijer.

big thx … it really works fine :slight_smile: *** quack ***