Performing Loop query ( for parts replaced)

G

Guest

Hello:

I'm wondering if there is a way to build a query that will repeat itself
based on the its own results.

Here is what I mean:

{Related fields in my table are "PartNumber" and "SupersededBy". If the
PartNumber is not replaced by another part, the field displays "N/A".}

My parameter query should prompt user to enter a "PartNumber". Let's say
"part1" is entered. Assuming that "part 1" is superseded (recplaced) by
"part2", I would like the fields of the first row to contain:

PartNumber="part1", SupersededBy="Part2"

(Simple enough....Here's what I can't figure out:)

If "part2" has also been superseded, I want the second row of the query
results to return:

PartNumber=part2, SupersededBy=part3

Until say:

PartNumber=part3, SupersededBy="N/A"

At this point is where the query result should stop. So for my example
the query would return 3 records, with fields: PartNumber (and) SupersededBy.

Can something like this be done? Please say yes, please!

Thank you!

--Gabriel
 
G

Guest

This ain't the complete as it returns more than you want. Maybe you can work
on it somemore.
Mercadogs_1 ---
SELECT Mercadogs.PartNumber, Mercadogs.SupersededBy
FROM Mercadogs
WHERE (((Mercadogs.SupersededBy) Is Not Null));

SELECT Mercadogs.PartNumber, Mercadogs.SupersededBy, Mercadogs.Etc
FROM Mercadogs, Mercadogs_1
WHERE (((Mercadogs.PartNumber)=[Enter part number])) OR
(((Mercadogs.PartNumber)=[Mercadogs_1].[SupersededBy]))
GROUP BY Mercadogs.PartNumber, Mercadogs.SupersededBy, Mercadogs.Etc;
 
G

Guest

Thanks a lot Karl! I will try this to see how it goes!

KARL DEWEY said:
This ain't the complete as it returns more than you want. Maybe you can work
on it somemore.
Mercadogs_1 ---
SELECT Mercadogs.PartNumber, Mercadogs.SupersededBy
FROM Mercadogs
WHERE (((Mercadogs.SupersededBy) Is Not Null));

SELECT Mercadogs.PartNumber, Mercadogs.SupersededBy, Mercadogs.Etc
FROM Mercadogs, Mercadogs_1
WHERE (((Mercadogs.PartNumber)=[Enter part number])) OR
(((Mercadogs.PartNumber)=[Mercadogs_1].[SupersededBy]))
GROUP BY Mercadogs.PartNumber, Mercadogs.SupersededBy, Mercadogs.Etc;

--
KARL DEWEY
Build a little - Test a little


Mercadogs said:
Hello:

I'm wondering if there is a way to build a query that will repeat itself
based on the its own results.

Here is what I mean:

{Related fields in my table are "PartNumber" and "SupersededBy". If the
PartNumber is not replaced by another part, the field displays "N/A".}

My parameter query should prompt user to enter a "PartNumber". Let's say
"part1" is entered. Assuming that "part 1" is superseded (recplaced) by
"part2", I would like the fields of the first row to contain:

PartNumber="part1", SupersededBy="Part2"

(Simple enough....Here's what I can't figure out:)

If "part2" has also been superseded, I want the second row of the query
results to return:

PartNumber=part2, SupersededBy=part3

Until say:

PartNumber=part3, SupersededBy="N/A"

At this point is where the query result should stop. So for my example
the query would return 3 records, with fields: PartNumber (and) SupersededBy.

Can something like this be done? Please say yes, please!

Thank you!

--Gabriel
 

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