Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old October 30th, 2007, 08:20 PM
Authorized User
 
Join Date: May 2007
Location: Fairfax, va, USA.
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default where to call subreport from main

Hi all,

I have a main report that calls a subreport. If I just use the wizard and have nothing complex, it works fine. However, I have to dynamically populate the report because my query can produce a different number of columns each time. I have used VB code in the subreport to do this and it works fine when I call the subreport alone. When I call it from the main, it does not put the values in. Has anyone had this happen? Where should I call the report from the main? I assume that I will have to call it from VB code and not rely on the wizard.

Thanks
  #2 (permalink)  
Old October 30th, 2007, 11:48 PM
Friend of Wrox
 
Join Date: Mar 2004
Location: Yorba Linda, California, USA.
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default

Did you try the On Open event for the subreport? (Go to the Report Property Sheet for the Subreport. The first time you click on the subreport in design view you get the subreport properties, the second time the Report Properties come up. You can get to the On Open from there)

  #3 (permalink)  
Old October 31st, 2007, 05:54 AM
Authorized User
 
Join Date: May 2007
Location: Fairfax, va, USA.
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes. I put the header creation in the open event on the subreport and it works fine. If I try to move the values into the textboxes, I get a error though. I think it is because the query has not run yet on the open event. I tried putting it into the on Activate event and it works if I just run the subreport. It will not run from the main report though(I only get the headers and the text boxes where the totals are suppose to go are blank). I need to find a place in the main report to run it. If I can get the VB command to run the subreport, I was going to try calling it from the main after the main report does its processing. I have looked on google and in my books to see if I can find the VB code to call a subreport but can't find it.

Thanks


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing parameters from main report to subreport Swati_Jain Crystal Reports 0 May 24th, 2006 09:04 AM
supress pageheader of main report in subreport padma_eedara Crystal Reports 0 January 27th, 2006 09:07 AM
Subreport not displaying no data message in main lic023 Access 0 March 15th, 2005 08:15 AM
A subreport cannot contain a subreport. dkells Crystal Reports 0 March 3rd, 2005 06:05 PM
Can Main and SubReport get data fr different table yblee Crystal Reports 0 August 19th, 2004 03:37 AM





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