Solved

Passing WhereCondition to a subreport

Posted on 2004-10-07
8
400 Views
Last Modified: 2012-06-21
I am making a report, which has a sort of summary in the report header.  I was thinking that a subreport would be the best way to do this, but I need to be able to pass along the wherecondition that the main report was opened with.  I can't figure out how to do this.  Can someone help me?
0
Comment
Question by:Peepsalot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
8 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 30 total points
ID: 12250424
Whatever the criteria is, make it a textbox on your main report.  If you don't actually wish to display it, then make it .Visible = No.

Then in your subreport, refer to it as Me.Parent!WhateverYourControlNameIs.

If this doesn't get you there, then you should probably use a query for your subreport's .RecordSource that also reflects the 'where condition' of your main report's .RecordSource.

Hope this helps.
-Jim
0
 
LVL 2

Author Comment

by:Peepsalot
ID: 12250678
The whereCondition comes from opening the report with:
docmd.openreport reportname, view, filtername, wherecondition

This where condition is dynamic, and varies each time the report is opened.  The value of it is determined by some asp code that invokes access.  My problem is I don't know how to access this information inside the report.  How would I set this textbox?  Anyways, the textbox is unnecessary, since if I knew how to set it, I could just put that into Me.Parent!variableThatTextBoxIsSetTo.  So the question is how to get and set the wherecondition in a report.

0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 12250766
Go into Report Design, click on the subreport, right-click:Properties, make sure the properties title says "Subform/Subreport" and not "Form"  (what a pain in the a&* this is), and on the Data tab eyeball the 'Link Child Fields' and 'Link Master Fields' properties.  

Since the Where condition is fed into your main report, and if you have the main and the sub correctly linked, the subreport *should* reflect the main report's Where condition.

-Jim
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:Peepsalot
ID: 12250831
I don't think I can do this by linking fields, because the subreport is a summary of the entire parent report that is only diplayed in the report header.  The summary needs to show a total count for each category, then the main report lists the details of each record for every category.

The way I understand it, if I linked a subreport like you are saying, would only be linked for the first record of the main report's recordset, which would not allow enough information for the subreport to do a summary.
0
 
LVL 2

Author Comment

by:Peepsalot
ID: 12251175
So is there no way to reference the wherecondition property of a report?  If I just knew how to call that, I think the solution would be simple enough.
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 12251201
Not from subreport to main report, afaik.
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question