Retrieve records, and all records joined to those records, etc., e

P

Peter Stone

Access 2002-2003, XP

I have a table tblRec with a self join using table tjnRecPtof (two fields
RecID and PtofID). I want to retrieve all records joined to a particular
record (e.g. PtofID =7), and then all records joined to those records, and
then all records joined to those records, etc., etc.

Thank you
 
T

Tom van Stiphout

On Wed, 10 Jun 2009 16:47:01 -0700, Peter Stone

Alas, Access can't do that, afaik. This requires support for recursive
queries, which SQL Server first implemented in version 2005 but Access
may never support this.
Next best ideas include:
* Put the same table on the query several times, properly linked, and
hope that the relations don't go deeper than your number of tables.
* Write some VBA code to recursively populate a "temporary" table, and
go from there. I have done this successfully for an app where we truly
did not know how deep the nesting could be. Not very fast, but it
works reliably.

-Tom.
Microsoft Access MVP
 
P

Peter Stone

Tom van Stiphout said:
On Wed, 10 Jun 2009 16:47:01 -0700, Peter Stone

Alas, Access can't do that, afaik. This requires support for recursive
queries, which SQL Server first implemented in version 2005 but Access
may never support this.
Next best ideas include:
* Put the same table on the query several times, properly linked, and
hope that the relations don't go deeper than your number of tables.
* Write some VBA code to recursively populate a "temporary" table, and
go from there. I have done this successfully for an app where we truly
did not know how deep the nesting could be. Not very fast, but it
works reliably.

-Tom.
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top