Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004
    Prineville, OR

    Unanswered: Pass Parameter to Sub Report from Main Report

    I am a self taught Access user and picked up much of my knowledge from various books and by deciphering many of the postings here. That said, here is my problem:

    I am trying to pass a same parameter "Start Date" and "End Date" on my main report to the sub report(s). In other words, I only want each one asked once when I run the report. Currently it asks for each twice.

    Also, if anyone is feeling real generous with the advice I need the proper format to add totals from the sub reports on the main report (they will all be in the same section of the main report), i.e. Unbound Textbox with a control source "=Sum([SubRpt1Total] + [SubRpt2Total])" on the main report.

    Here are some generic details on the concept:

    Report: MainRpt
    Control Source: MainRptQuery
    Parameter (from Query): [Start Date] and [End Date]

    SubReport: SubRpt1
    Control Source: SubRpt1Query
    Parameter (from Query: [Start Date] and [End Date]
    Unbound Textbox: SubRpt1Total
    Control Source: =Sum([SubRpt1_Amt])

    SubReport: SubRpt2

    The [Start Date] and [End Date] will be the same across all queries so how do I get it to ask it only once?

    I want to total the sub report totals on the main report, what is the proper format for that?

    Thanks in advance for any help.

  2. #2
    Join Date
    Nov 2007
    Adelaide, South Australia
    Use a custom dialog would be my first suggestion.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!

    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    May 2005
    Nevada, USA
    Provided Answers: 6
    I would have the user enter the dates on a form and have both queries get the values from the form.


  4. #4
    Join Date
    Jan 2004
    Prineville, OR
    Thanks both of you for the ideas, I will give them a try and just post again if I need help with the details.

  5. #5
    Join Date
    Dec 2004
    Madison, WI
    Check the code bank for some reporting examples. There are some there which do exactly what you're attempting to do.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts