Solved

Passing WhereCondition to a subreport

Posted on 2004-10-07
8
413 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 66

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 66

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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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 66

Expert Comment

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

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

624 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