Filter query from a query

Joy83

Member
Local time
Today, 03:43
Joined
Jan 9, 2020
Messages
116
here is my question
I have a report that uses a query (query 2)
Query 2 is actually using another to build up (query 1)
In the report load event there are few sqls that populate data in text boxed mainly using (query 2)

How to run the report in away that make sure that query 1 also get filtered too

example: query 1 filter the date

query 2 filter the products purchased in this date.

i need the two queries in my report . How to do that
 
you need to Add the Date from Query1 to your Query2, then you can
just filter Query2.
 
Thanks your reply
in the load event in the report I read a variable from a form which filters me query 2 and populate the report
I just noticed thar my report is reading a query that is depending on another query that I need to filter as well.
Is there any way that I can filter query 1 in the load first
So my query 2 can read the filtered query 1
 
Set tempvars and refer to them in the base query?
Need to do that in the form or perhaps open event of report.
 
can you just make another Query that does not depend on Query1?
so you can just focus on filtering this New Query?
 
Set tempvars and refer to them in the base query?
Need to do that in the form or perhaps open event of report.
How to do this
I have the variable in the form
How to pass it and run it to the base query and execute it before I run the report ti make sure that i am reading correct data
 
You just set the tempvars with the correct data, then use them as criteria in the first query.
Only issue would be if that query is the base query for others that do not need/want that criteria.
 
You just set the tempvars with the correct data, then use them as criteria in the first query.
Only issue would be if that query is the base query for others that do not need/want that criteria.
That’s a good workarround
I can create another query for the other uses and specific one for this report

can u help me or maybe share a link or something
How to run a query from that temporary variable (form textbox) what would I write in the criteria that indicate that variable
 
@Joy83
I recommend you show us some of your table and query structure.
Perhaps you could show your query sql; and a description of the data involved including the before and after you'd like with the filter.
 

Users who are viewing this thread

Back
Top Bottom