Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Link problem on subreport - only returning 1 record

Status
Not open for further replies.

bhoran

MIS
Nov 10, 2003
272
US
I have a report and a subreport.

That report is based ona table and has a filter coming from a multiselect listbox.
tis report is grouped by; Brand, LPGCode. The detail includes the field Account.

The subreport source is a query that essentially rolls up the records on the table in the main report and converts them to a dollar value, however, this query is a summary so only needs to show it by Brand and account.

I.e. the subreport is grouped by Brand only and has Account in the detail. (The subreport is in the Brand footer or main report - to show total value for each account for that brand).

The issue I have is that if I link by brand only all accounts and their values are listed, (but some accounts are not in main report due to filter from multi-select listbox).

If I link by Brand and by Account i get only the last account in each brand not all accounts on the main report.

Is there another way to link these reports? Can I pass the filter from trhe main report to the subreport therby allowing me to link by brand only?

 
I assume your report layout is like:
Brand Header
LPGCode Header
Detail Account field
LPGCode Footer
Brand Footer
Subreport joined to main report by Brand
Detail Account
If you want to filter the subreport to only the accounts included in the main report, then you can use code to change the SQL property of the saved query the subreport is based on.

I think I have provided the code for this in a previous thread. Do you understand this code?

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Sorry Duane I am all over the place with these posts, I did think that the code you have supplied would be one way to sort this out. I have tried it but got an error - I have replied stating that in the other thread.

I don't fully understand that code but we should discuss it in that thread.

Thanks for all you help today!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top