Displaying Record Numbers


Q: In dBASE 5.0 for DOS, I used to create a text line with the current record number using @ 05,10 SAY RECNO() or something in that style. Now I would like to do the same in my form with dB7 using a Text object. I tried as follows, but it doesn't work. When I browse in the form, the value maintains the first record:

   this.TEXT1 = new TEXT(this)
       with (this.TEXT1)
       ...
       text = {||Recno()}
       ...
       endwith

A: That should work if you're using the old XDML commands (USE, etc.).  However, the data objects (query, etc.) do not support record numbers, thus RECNO() is not a valid piece of information.  Also, record numbers will change due to such operations as PACK. 

If you need a guaranteed unique value to identify each record, you may want to consider using an auto-increment field.  It cannot be changed, and it receives a unique value for each record added to the table.