Merge Reports
I am trying to take two seperate reports and print them together. I have been searching the forums and web and have tried everything. However, when I go to print the report it's just showing me the last report. I have tested the code individually and each report works on it's own but not when I try to combine them.
    { Print for files }
      frxRptMain := TfrxReport.Create(nil);
      frxRptMain.EngineOptions.DoublePass:= true;
      frxRptMain.FileName := 'RenewalPackage_'+fBondNbr;
      if frxRptNotice <> nil then FreeAndNil(frxRptNotice);
      frxRptNotice := TfrxReport.Create(nil);
      frxRptNotice.LoadFromFile(ExtractFileDir(application.ExeName) + '\FastReport\procrptNotice.fr3');
      tOrigQry := Trim(TfrxADOQuery(frxRptNotice.DataSets[0].DataSet).SQL.Text);
      TfrxADOQuery(frxRptNotice.DataSets[0].DataSet).SQL.Text := tOrigQry + ' where BondNo = ''' + fBondNbr + ''' ' +
        ' and SessionID = ''' + IntToStr(fSessionID) + ''' ';
      frxRptNotice.PrepareReport(False);
      fMemStm := TMemoryStream.Create;
      frxRptNotice.SaveToStream(fMemStm, True, True, True);
      fMemStm.Position := 0;
      frxRptMain.LoadFromStream(fMemStm);
      fMemStm.Free;
      //frxRptMain.PrepareReport(False);
      if frxRptSummary <> nil then FreeAndNil(frxRptSummary);
      frxRptSummary := SetupReport(ExtractFileDir(application.ExeName) + '\FastReport\Bond Summary.fr3',[fBondNbr,'Y',edtPrintDate.Date]);
      frxRptSummary.PrepareReport(False);
      fMemStm := TMemoryStream.Create;
      frxRptSummary.SaveToStream(fMemStm, True, True, True);
      fMemStm.Position := 0;
      frxRptMain.LoadFromStream(fMemStm);
      fMemStm.Free;
      frxRptMain.PrepareReport(False);
Comments
Try frxRptMain.PreviewPages.LoadFromStream(fMemStm) to build compound report.
frxRptNotice := TfrxReport.Create(nil);
frxRptNotice.LoadFromFile(ExtractFileDir(application.ExeName) + '\FastReport\procrptNotice.fr3');
tOrigQry := Trim(TfrxADOQuery(frxRptNotice.DataSets[0].DataSet).SQL.Text);
TfrxADOQuery(frxRptNotice.DataSets[0].DataSet).SQL.Text := tOrigQry + ' where BondNo = ''' + fBondNbr + ''' ' +
' and SessionID = ''' + IntToStr(fSessionID) + ''' ';
frxRptNotice.PrepareReport(True);
frxRptNotice.LoadFromFile(ExtractFileDir(application.ExeName) + '\FastReport\Bond Summary.fr3');
frxRptNotice.PrepareReport(False);
frxRptNotice.ShowPreparedReport;[/code]