p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access (http://p2p.wrox.com/forumdisplay.php?f=18)
-   -   subreport parameter (http://p2p.wrox.com/showthread.php?t=63253)

lisabb October 26th, 2007 08:27 AM

subreport parameter
 
Ok... I have a query that excepts a parameter and produces the desired result. I am using this query in a report that is being used as a subreport. The main report pulls its data from a table and does not have a input parameter but one of the fields on the main report has the value I need as parameter to the subreport. I have tried doing the link between main and child in the properties but my subreport always comes up blank. What am I doing wrong?

lisabb October 26th, 2007 09:49 AM

Update... my main report uses a table. my subreport uses a crosstab query that is based off of a parameter query. The query works but I have to actually put in the parameter at run time. I have tried linking the subreport to the table that the main report uses but that table is a temp table that gets created and then deleted at run time. I don't even need the two reports (main and sub) to be linked. I can get the parameter for my sub elsewhere. When I run the report, it works except the subreport is blank and never even gets called so I need a link in there I guess.

Loralee October 26th, 2007 12:10 PM

Lisa,
I tried looking up the order of events for a subreport but could not find when the subreport loads in relation to the main report. If it were a form, the subform loads before the main form. If the same thing happens with reports (the subreport "loads"/opens first) you might be able to insert your parameter value at that point. Have you tried stuffing your parameter from the dialog form via a variable to the subreport by using the Open Event of the subreport(report property page?)

Here is what HELP says for Order of Events for REports: (to maintain the contents I just pasted the whole thing)
Order of events for reports and report sections:
Events occur for reports and report sections when you open a report to print or preview it, or close a report.
Events for reports
When you open a report to print or preview it and then later close the report or move to another window in Microsoft Access, the following sequence of events occurs for the report:
Open Þ Activate Þ Close Þ Deactivate
When you switch between two open reports, the Deactivate event occurs for the first report, and the Activate event occurs for the second report:
Deactivate (report1) Þ Activate (report2)
The Deactivate event for a report also occurs when you switch from the report to another window in Access. However, the Deactivate event doesn't occur when you switch to a dialog box, to a form whose PopUp property is set to Yes, or to a window in another application.
When you open a report that is based on a query, Access triggers the Open event before running the underlying query. As a result, you can set the criteria for the report by using a macro or event procedure that responds to the Open event. For example, the macro or event procedure could open a custom dialog box in which you enter the report criteria.
Events for report sections
When you print or preview a report, the Format and Print events occur for the report sections after the Open and Activate events for the report and before the report's Close or Deactivate events:
Open (report) Þ Activate (report) Þ Format (report section) Þ Print (report section) Þ Close (report) Þ Deactivate (report)
In addition, the following events can occur during or after formatting but before the Print event:
· The Retreat event occurs when Access returns to a previous section during report formatting.
· The NoData event occurs if there are no records displayed by the report.
· The Page event occurs after formatting but before printing. You can use this event to customize the appearance of the printed report.




All times are GMT -4. The time now is 09:08 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.