Wrox Programmer Forums
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 26th, 2007, 08:27 AM
Authorized User
Join Date: May 2007
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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?
Old October 26th, 2007, 09:49 AM
Authorized User
Join Date: May 2007
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts

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.
Old October 26th, 2007, 12:10 PM
Friend of Wrox
Join Date: Mar 2004
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post

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.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing parameter to subreport lathika Visual Studio 2005 0 January 11th, 2008 12:53 PM
Passing parameter values to subreport pvalade Crystal Reports 0 November 21st, 2006 12:30 PM
subreport srnarla Crystal Reports 1 August 31st, 2006 10:48 AM
subreport bib Visual Basic 2005 Basics 0 August 25th, 2006 12:56 AM
forwarding a parameter to the subreport ! sansmail Crystal Reports 0 April 19th, 2004 10:19 AM

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