Solved

Passing WhereCondition to a subreport

Posted on 2004-10-07
8
405 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

751 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