Dynamic subreport group level control source

Posted on 2009-02-09
Last Modified: 2013-11-28
Using Microsoft Access 2000

Is it possible to dynamically set the Group Level Control source of a subreport?


Given two reports where rptSubMain is a subreport of rptMain

Is it possible, based on outside parameters from a form or the main report, to dynamically set the group level of rptSubMain?

So, in rptMain

Me.rptSubMain.Report.GroupLevel(0).ControlSource = ""

This statement gives an error message 2455 saying the expression has an invalid reference.

I've tried everything but always end up with errors saying that I cannot change the property while printing, or the report is not open or non-existent.

I'm not looking for sorting or filtering here, I need it to actually Group because the subreport is doing totals and averages based on a different query than the main report.
Question by:huston8481
    LVL 74

    Expert Comment

    by:Jeffrey Coachman

    Yes, but it is *much* easier to just insert two subreports and simply toggle the visibility.

    Here is a sample


    Author Comment


    Thank you for your response.  Unfortunately I could not open your sample with Access 2000 or Access 2002.  Was your sample created in a higher version?
    LVL 74

    Accepted Solution

    Here is the file in the Access 2000 format

    Author Comment

    Thanks again.
    LVL 74

    Expert Comment

    by:Jeffrey Coachman

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    The first two articles in this short series — Using a Criteria Form to Filter Records ( and Building a Custom Filter ( — discuss in some detail how a form can be…
    It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
    Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
    With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now