I suspect that the Access version of SQL (don't know this for sure) doesn't support recursion. SQL Server 2005 I read does support something called Common Table expressions that allow for recursion.
Can SQL support recursion? LINK
However apparently you can obtain hierachies using SQL without necessarily resorting to recursion.
Determining Hierachy using SQL without the requirement for recursion
I suspect this second solution might be possible using SQL in Access.
(CAUTION don't know for sure)
My first thought like you Mihail was a VBA loop using recursion with a similar structure to below.
Let us take an organisation with 14 employees organised as follows with this information being stored in one table with field 1 being manager and field 2 minion/underling.
1 manages 2
1 manages 3
2 manages 4
2 manages 5
4 manages 8
4 manages 9
5 manages 10
3 manages 6
6 manages 11
3 manages 7
7 manages 12
12 manages 14
7 manages 13
It would be useful for anyone following along to draw the structure out as a pyramid.
Certainly the definition of the top boss is easy - anyone that is in the first field but not the second field and the definition of a John Doe easy they appear in field 2 but not field 1.
Middle management is anyone that exists in both fields.
To find out how many and who one individual manager manages is where I think you would have to have the recursive VBA or SQL. You would effectively filter on the first field based on the ID of the individual you want to determine minions for.
Of the subsequent set(Lets call it the first set) you would wish to recursively filter the whole set based on the second column of the first set. You would continue recursively filtering on the second field name of the subset of the former set until you not longer got unique pairs. Add all the unique pairs of all those subsets and you have how many employees that individual manages. ie. the second column of the combined set of all the filtered first sets would give you all the people that are in some way managed by the individual you originally searched on.
I thought this all up after having drawn out a pyramid - then did a search on google and found the links I moved to the start of my reply.
Maybe should have done the search first!
Good question though Mihail