I have two control fields in table. one is "mainid" and other is "referedby". mainid is unique and one member in "mainid" can appear in "referedby" 'n' no. of times. so a tree type view will appear. Now I want to calculate the no. of legs in the tree at each level down the tree. how can I? pls. help.