Access - Passing parameters to subqueries?
I have an access database that has a fairly complicated saved query in place.
I'm going to spare the details except to say that there's a table "R" that has a bunch of records containing timestamps, user IDs, and a bunch of domain specific info.
The query in question has to return a summary of numbers on each user ID, including total number of records that meet an assortment of conditions.
I decided since I need to do a bunch of counts on one table but of different lines that meant subqueries, and to keep it vaguely readable I put each subquery in it's own saved query (some of which have further subqueries as saved queries) and join them together to get my results.
Here's where I problem has come up -- I suddenly need to be able to do that lookup for an arbitrary date range, rather than all of the data.
I could do that by combining all of the subqueries inline, but that would quickly become difficult to follow and modify if it ever needs changed again.
I'd rather just add a parameter to the bottom level queries that actually work with the data, and pass the parameter from the final top level query down to the save subqueries, but I have not a clue how to do that.
Concept:
Query A joins queries B, C, and D. B joins E and F. C, D, E, and F all do various totals on different lines of table G. I need to be able to query A and get results for a specific range of a timestamp column in G. B-F would all be using the same timestamp range for this calculation.
|