Pass parameters to underlying query from multiple report/form (1 Viewer)

ini_ya

New member
Local time
Today, 05:53
Joined
Nov 7, 2012
Messages
3
Hi,

I have a report which has two sub-reports in it. There is 3 underlying queries which are fetching data for the report. all the 3 queries are saved separately.

One of them is like below

SELECT Tbl_Txn_Invoice.Invoice_ID, Tbl_Txn_Invoice.Invoice_Ref_No, Tbl_Mas_Client.Client_Name, Tbl_Mas_Client.Client_Address, Tbl_Txn_Invoice.Invoice_Date
FROM Tbl_Txn_Invoice INNER JOIN Tbl_Mas_Client ON Tbl_Txn_Invoice.Client_ID = Tbl_Mas_Client.Client_ID
WHERE (((Tbl_Txn_Invoice.Invoice_ID)=[Forms]![Frm_Modal_Invoice_Generation]![inv_id]));

the other two queries also have "where" condition on "[Forms]![Frm_Modal_Invoice_Generation]![inv_id]));"

Now I want to run the same report with the same queries but need to call this from a different form. I am trying to find a way to pass the inv_id to the queries in a way so that it can work from two different forms calling the same report.

Please help. I am new to Access.

Thanks so much,

Ini

PS this is my first query here as so far I have always managed to find answer just by searching. This forum is invaluable help to programmers.
 

ini_ya

New member
Local time
Today, 05:53
Joined
Nov 7, 2012
Messages
3
Can't this be done at all? or is there a possible workaround? Will appreciate any help, as on a tight deadline on this one.

Thanks so much again

Ini
 

JHB

Have been here a while
Local time
Today, 02:23
Joined
Jun 17, 2012
Messages
7,732
How do you open the report, from a button on a form or ..??
If you open the report from a button then you can use the DoCmd.OpenReport with a "wherecondition"
Syntax
DoCmd.OpenReport reportname[, view][, filtername][, wherecondition]

You can find examples in the Help-file.
How are the sub-reports linked to the master report?

If they are linked correct, does the query for these sub-reports need the [inv_id] as a parameter?
 

Users who are viewing this thread

Top Bottom