There is no general answer, though a couple of specific answers might be viable...
Case 1. The query / underlying table has a unique index (which might or might not be the prime key) AND the query is using the same sort order as would be imposed by sorting on the unique index.
In this case, you can use an expression resembling
"1+DCount( "field", "table", "[field] < " & CStr( [field] )
If you are not familiar with DLookup, it is in the Help files.
Case 2. The query / underlying table does not have a unique index OR the query is not sorting in the order of the existing index OR the field on which the sort DOES occur is not unique.
No simple solution exists. None that I would care to approach, anyway.
But if worst comes to worst, CREATE a column on the table and dump numbers into it based on an arbitrary but uniquely-assigned numbering scheme. Then apply the principles of case 1 above.