Run query based on results of query

G

Guest

Is there a way to dynamically run a query (or a series of queries) based on
the results of a single query? I believe I need to be able to run a
hierarchical set of queries to capture all employees that report to a
supervisor. If any of those employees are supervisors, I want to list all of
the employees that report to them.

Can someone tell me the best way to accomplish this?

tia
 
R

Rick B

You can build a query based on another query (instead of a table) if that is
what you are asking.

When you are in design view and click the icon to add a table, you will
notice that you can pick tables, or saved queries.

Rick B
 
G

Guest

Thanks for the quick reply.

Let me rephrase this a little.

I have a form where a user (either a supervisor or an employee) can access
his or her Annual and Sick leave report (which shows balances, usage, etc).
I've got it set so that if the NT User (the logged on userID) is a
supervisor, I can capture their immediate employees and their report. If any
of these immediate employees are themselves supervisors, I want to be able to
run a query to bring up their data.

I have a Director (Bill), who has 4 supervisors (Lou, Rick, Kathy, and Joe).
Let's say that when the Bill logs on to his pc and opens this reporting
form, I want him to be able to look at the leave records for himself, Lou,
Rick, Kathy, and Joe as well as all the supervisors and/or employees that
report to Lou, Rick, Kathy, or Joe.

In addition, if Kathy logs on to her pc and opens the reporting form, I want
her to be able to look at her own leave records, and any supervisor and/or
employee that report to her or any of her supervisors.

The higher up in the hierarchy, the more leave reports they should see. Me,
being a mere employee, would be able to see just my records, and no one
else's. There can be any number of employees downstream, so to speak; but
there is a finite number of supervisors (thank goodness for that).

I have it working now that when Bill opens the report he can get the leave
records for Lou, Rick, Kathy, and Joe; but not anyone downstream of them.
THAT's why I thought I would run a query based on the results of another
query. Each employee has empID, IsSupervisor (yes/no), supervisorID fields
in their record.

thanks again,
JMorrell
 

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