Solved

Passing WhereCondition to a subreport

Posted on 2004-10-07
8
363 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
  • 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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 …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now