autonumber in query column

prodigy

Registered User.
Local time
Today, 14:32
Joined
Apr 22, 2005
Messages
66
I have created a query which returns (say N rows). Now I would like to include a column which would show the record in serial numbers (ie 1st row of that column would display '1', 2nd row would display '2', 3rd would display '3' ,......., Nth row would display 'N'. Any assistance is appreciated.
Thanx.
Prodigy.
 
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.
 

Users who are viewing this thread

Back
Top Bottom