open report with filter on 3 subreports

N

nova

I have a report without recordsource that includes 3 subreports based on 3
different queries. So there's no link between subreports and main report as
the main report is just used as a collector of the 3 subreports. Each of
these queries have 2 similar fields called 'seller' and 'buyer'. What I want
to do using vba is enter one code and open the report where each of the
subreports will only show records where seller OR buyer is equal to that code.
I know how to open a report with a filter on the recordsource, but I'm not
sure if I can do this for a subreport.
 
O

Ofer

I would create a global variable, and assign the value of the code to that
variable.
Then I would create a function in a module that return the value of that
variable

global MyCode as ...

function GetCode()
 
O

Ofer

Sorry I sent it to early

I would create a function
Global CodeVariable as ....

function GetCode()
GetCode=CodeVariable
end function

I would then use this function to filter the reports recordsource

"Select * From MyTable Where CodeField = GetCode()"
 

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