FastReport printing Summary page with every additional page in non-database report

I am trying to print a report with a summary page as the first page then multiple pages thereafter. This is my Delphi 2010 code:

procedure TForm1.Button1Click(Sender: TObject);

var

 fPage:TfrxReportPage;

 Text:TfrxMemoView;

 i:Integer;

begin

 with frxReport1 do

  { frxReport1 comprises 2 pages. Memo1 is on page1, Memo2 is on page2 }

 begin

  fPage := frxReport1.Pages[1] as TfrxReportPage;

  with fPage do

  begin

   { Memo1.text is initially set to 'This is page 1' in Designer }

   Text := frxReport1.FindObject('Memo1') as TfrxMemoView;

   Text.Text:='Front Summary Page';

  end;

  PrepareReport;

  fPage := frxReport1.Pages[2] as TfrxReportPage;

  with fPage do

   for i := 2 to 3 do

   begin

    { Memo2.text is initially set to 'This is page 2' in Designer }

    Text := frxReport1.FindObject('Memo2') as TfrxMemoView;

    Text.Text:='This should be Page '+IntToStr(i);

    PrepareReport(False);

   end;

  ShowPreparedReport;

 end;

end;

The above code has been simplified, in practice there are 2 to 16 pages and each page contains over 60 memo's

The report gives the following output:

Page 1 > Front Summary Page

Page 2 > This is Page 2

Page 3 > Front Summary Page

Page 4 > This should be page 2

Page 5 > Front Summary Page

Page 6 > This should be page 3,

Anyone any ideas where I am going wrong?

Comments

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.