Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 23rd, 2014, 02:30 PM
Registered User
Join Date: Oct 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.


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.
Old July 21st, 2016, 07:00 AM
Posts: n/a

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.

Similar Threads
Thread Thread Starter Forum Replies Last Post
passing parameters to Access Report murtazasif Access VBA 2 November 6th, 2007 12:32 PM
Passing parameters to Access query pcassistnw Access 0 March 2nd, 2007 11:07 PM
Passing Multiple Parameters into Access Query rit01 Classic ASP Databases 1 October 26th, 2005 04:00 PM
Access Forms Open Method of Passing Parameters androman Access VBA 8 September 22nd, 2004 09:04 AM
Access subqueries with parameters moved to SQL Mitch Access 8 March 10th, 2004 01:27 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.