Solved

Passing WhereCondition to a subreport

Posted on 2004-10-07
8
381 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

813 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

17 Experts available now in Live!

Get 1:1 Help Now