Results 1 to 6 of 6
  1. #1
    f15e is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2016
    Posts
    71

    Call a SubReport within the Main Report from a Form

    What I am trying to do is call a subreport within the main report from a form. Form -> Main Report -> SubReport
    What is the correct syntax for doing this, if it is possible at all?



    What I'm trying to accomplish is when exporting the report to .rtf format, change the font color to black and then after the export is complete, changing it back to white. The report has headings with a green background and white font. When exporting to .rtf, the background green color is not exported but the white font is and when you open the .rtf after export, you can't see the headings even though they are there. I know you will say change the font color in the report but in this case I can't b/c those are the colors requested to be used. I'd appreciate any help you could provide on this. Thanks.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Try:

    Code:
    Reports!ReportName.SubreportName.Report.ControlName
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Not sure what this means - What I am trying to do is call a subreport...
    Anyway, you should be able to set the fore color property before the output without having to worry about altering the report design on close. That should affect the output font color and you should not get a prompt to save the report on closing.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    f15e is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2016
    Posts
    71
    Quote Originally Posted by Micron View Post
    Not sure what this means - What I am trying to do is call a subreport...
    Anyway, you should be able to set the fore color property before the output without having to worry about altering the report design on close. That should affect the output font color and you should not get a prompt to save the report on closing.
    Could you please explain in a little more detail? My code for calling to export the report as .rtf is in a form where I would assume is where I would have to put code to change the font color for the affected report text boxes prior to exporting. See pic below of how it is currently being exporting and how I would like it to be. Just as a repeat, unfortunately the header text needs to be white against a background green color for printing purposes. I realize the background color is not transferred to the .rtf export. Thank you.
    Click image for larger version. 

Name:	Example.jpg 
Views:	9 
Size:	155.3 KB 
ID:	27347

  5. #5
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Open the report first. If you don't want it to be visible, open it hidden
    add a line like this before the line that does the output
    Reports!rptYourReport.TxtComany.ForeColor = vbBlack
    DoCmd.OutputTo...
    DoCmd.Close Reports!rptYourReport (as I said, I don't think you'll get a save prompt, but if you do, handle it with the DoCmd.Close parameters.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 8 Access 2013
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    A simple solution that I use is to do a "Save As" to make a copy of the report with "_ForExport" after the name.. Edit this new copy to what you need for exporting to RTF. Now you have one for printing and one for exports. Simple.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Conditional value from subreport to main report?
    By aellistechsupport in forum Reports
    Replies: 4
    Last Post: 06-10-2014, 02:08 PM
  2. Replies: 1
    Last Post: 04-15-2013, 10:02 AM
  3. Subreport with criteria from main report
    By Evilferret in forum Reports
    Replies: 1
    Last Post: 08-15-2012, 03:19 PM
  4. Replies: 3
    Last Post: 06-15-2012, 11:14 AM
  5. Combine Main Report with subreport
    By jortizz in forum Reports
    Replies: 2
    Last Post: 05-05-2011, 12:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums