Multiple queries, single input

jaye

New Member
Joined
May 19, 2004
Messages
26
Is it possible to have the user input data (for example a date), and then run queries without the user having to input the date again?

Thanks.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
I don't understand the question. Can you walk through an example of what you are talking about, maybe giving some detail regarding the structure of the table and the goal of the query?
 
Upvote 0
No problem.

I have a query that takes data from a table between a certain date and time. Say June 2nd and June 3rd. Now, I have separate queries that will separate this data into little sections of time (eg. between 2AM and 5AM). I am running 4 of these smaller queries.

Then, I have subforms that will add up the number of rows in these smaller queries (for efficiency analysis). Therefore, I have a large form that calls on all four subforms for it's data. However, when this large form is opened, it reqires that the date and time be input four separate times (due to the first, original query).

I am wondering if it is possible to have the user input this Date and time only once.

Thanks.
 
Upvote 0
So, let's see if I got this straight:

You have a Table, let's call it Table1.
From that table you have a Query (let's call it Query1) that selects records from Table1 based on Date Criteria (my guess is that it is a Parameter Query, am I right?). Then from that Query1 there are 4 "sub queries" which break the data from Query1 into four different time blocks. Your subforms are then run off of these 4 "sub" queries.

Now when you open the report, it prompts you to enter the date 4 times instead of just once.

Can we confirm:
The date parameter should just be on Query1, not on the 4 subqueries. Since the 4 sub queries call on Query1, whenever one of these queries is run, it asks for the date.

That is a very interesting scenario. I have done stuff like this in the past, but it requires VBA programming to create the SQL code necessary to run the queries. Basically, you create a "Criteria Form" that the user fills out (instead of a parameter query). VBA code then builds the queries behind the scenes. If you are not familiar with VBA code, you may not be comfortable with that solution, though.

Maybe someone else can suggest a non-VBA solution?
 
Upvote 0

Forum statistics

Threads
1,221,777
Messages
6,161,871
Members
451,727
Latest member
tyedye4

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top