Row numbers in query result using Microsoft Access

calendar_today Asked Jun 24, 2013
thumb_up 8 upvotes
history Updated April 16, 2026

Question posted 2013 · +5 upvotes

I always use this query in sql server to get Row number in a table:

SELECT *
FROM   (SELECT *,
               Row_number()
                 OVER(
                   ORDER BY [myidentitycolumn]) RowID
        FROM   mytable) sub
WHERE  rowid = 15  

Now I am working in Access 2010 and this seems to be not working. Is there any replacement for this query in Access?

Accepted answer +8 upvotes

Another way to assign a row number in a query is to use the DCount function.

SELECT *, DCount("[ID]","[mytable]","[ID]<=" & [ID]) AS row_id
FROM [mytable]
WHERE row_id=15

Top ms-access Q&A (6)

+8 upvotes ranks this answer #29 out of 55 ms-access solutions on this site .