Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jun 2004
    Location
    Lambertville, New Jersey, USA
    Posts
    82
    Thanks
    0
    Thanked 0 Times in 0 Posts

    can't set subReport recordsource from main report (97/2000)

    I'm trying to set the recordsource of a subreport while printing the main report. I've tried several itterations of command strings but can't seem to get it right. The compiler keeps telling me that it can't fine the field referenced in my command. I'm running this code from the main report.. I've been trying variations of the following 3 syntex strings:
    - reports!MainRptName!SubReportname.Report.recordsou rce = sqlstring
    - me!SubReportName.report.recordsource = sqlstring
    - me!SubReportName.recordsource = sqlstring
    Any advice?
    Also, in what main form event sould this code go?

    Thanks,
    Lance

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: can't set subReport recordsource from main report (97/2000)

    You can't set the recordsource of a subreport in code from the main report. In the On Open event procedure, the subreport hasn't been loaded yet, and in the On Format or On Print event of the report's sections, it is too late. Why do you want to do this? Setting the Link Master Fields and Link Child Fields properties of the subreport control on the main report should be sufficient.

  3. #3
    Star Lounger
    Join Date
    Jun 2004
    Location
    Lambertville, New Jersey, USA
    Posts
    82
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: can't set subReport recordsource from main report (97/2000)

    The subreport record (only one) is based on some Main Report calculations executed at the time of printing. Based upon these calculations, I need to place the appropriate field values from a query. I'll see if I can move the calculations to the main report data query and therefor enable me to use the Link Master/Child fields property.

    Thanks for the input
    Lance

Posting Permissions

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