How to change the RecordSource in a SubReport

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Simon

    How to change the RecordSource in a SubReport

    Dear reader,

    My SubReport is synchronized with a LinkMasterField and LinkChildField.
    If I put in the Open event of the SubReport

    Me.RecordSource = "QueryName"

    an error pups up. It seems to be that the open event of the SubReport will
    be
    activated after each record in the MasterReport. So an error pups up with
    the message "You can't change the RecordSource after the report is already
    open".

    Thanks for any help to solve this, changing a RecordSource in a SubReport

    Kind regards,
    Simon.




  • lyle fairfield

    #2
    Re: How to change the RecordSource in a SubReport

    There are several solutions you might try.

    1. Set (in the report's open procedure) the record-source of the sub-
    report to a public function; change the string returned by the public
    function;
    2. Set the sub-report's record-source in its property dialog to a
    query; change the SQL in the query;
    3. Set the sub-form's record-source in its property dialog to a query
    with dynamic parameters pointing at form control values;
    4. Replace the report with a carefully designed form;
    5. Change the record-source of the sub-report in code in design view
    and open the main report from code for each record or group of records
    that has identical sub-report record-sources.

    Some of these have been suggested to you in this and another thread
    you posted a year or so ago on the same subject and you have ignored
    them or declined to try them. Your testing them and making a clear
    report, in which you specify exact code and SQL, could provide a
    contribution to CDMA. As you have asked many questions, in my opinion,
    this would be appropriate.


    On Jun 6, 3:08 pm, "Simon" <SvanBee...@Ver satel.nlwrote:
    Dear reader,
    >
      My SubReport is synchronized with a LinkMasterField and LinkChildField. .
      If I put in the Open event of the SubReport
    >
      Me.RecordSource = "QueryName"
    >
      an error pups up. It seems to be that the open event of the SubReport will
    be
    activated after each record in the MasterReport. So an error pups up with
    the message "You can't change the RecordSource after the report is already
    open".
    >
    Thanks for any help to solve this, changing a RecordSource in a SubReport
    >
      Kind regards,
      Simon.

    Comment

    Working...