This is always messy. The SQL language doesn't handle recursion well, and
there is always the possibility of infinite recursion--usually bad data,
where a record is its own parent at some level.
Whenever I have had to do these, I've cheated by specifying a finite depth
that the records must resolve in. Then I walk the records in VBA code, and
resolve them into a temp table. If they don't resolve in the number of
levels supported, or if you find an infinite recursion, the code opts out
and tells the user to fix the problem and try again. Once the temp table
reflects all data, it besomes very simple to use to process the tasks
instead of trying to process the job in recursive queries.
There's a very simple SQL only solution to just 4 levels in this link:
http://allenbrowne.com/ser-06.html
If that approach is not suitable, Joe Celko has written several articles on
handling it in SQL, so you could follow his ideas. For a starting point:
http://www.intelligententerprise.com/001020/celko.shtml
http://www.dbmsmag.com/9603d06.html
http://www.dbmsmag.com/9604d06.html
http://www.dbmsmag.com/9605d06.html
http://www.dbmsmag.com/9606d06.html
HTH

Signature
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
>I am creating a Bill of Materials application using a table that stores
> parent/child relationships.
[quoted text clipped - 23 lines]
> Thnks for the help
> aWs
aWs - 16 Sep 2005 16:26 GMT
Thanks Allen,
I will go over these articals to see if they help.
aWs
> This is always messy. The SQL language doesn't handle recursion well, and
> there is always the possibility of infinite recursion--usually bad data,
[quoted text clipped - 48 lines]
> > Thnks for the help
> > aWs