Hi, you can do this with a select query provided your table has both the name and date in each row.
Create a new query, add the relevant table, view totals, add the name (sort ascending) and date (sort descending) fields to your query, right click the table -> properties -> change the table alias to a new name (e.g. "tblAlias" without the quotes), add a third field to your query, as follows :
Rank: (Select Count(*) from tblMaic Where ([PCP]=tblAlias.[PCP]) and ([DOS]> tblAlias.[DOS]))+1
Change "Group By" to "Expression" and add the following to the criteria of the rank field : "<=10" (without the quotes).
Please note that I used "tblAlias" as the Table Alias for the table I called "tblMaic", and I used the field names "PCP" and "DOS" (per your example). Make sure you change the table and alias and field(?) names to reflect the actual names you are using.
The SQL for the query follows :
SELECT tblAlias.PCP, tblAlias.DOS, (Select Count(*) from tblMaic Where ([PCP]=tblAlias.[PCP]) and ([DOS]> tblAlias.[DOS]))+1 AS Rank
FROM tblMaic AS tblAlias
GROUP BY tblAlias.PCP, tblAlias.DOS
HAVING ((((Select Count(*) from tblMaic Where ([PCP]=tblAlias.[PCP]) and ([DOS]> tblAlias.[DOS]))+1)<=10))
ORDER BY tblAlias.PCP, tblAlias.DOS DESC;
HTH, Andrew.
