Problem with DBGrid1 selection and frxReport1.Print.

edited 10:09AM in FastReport 4.0
Hello.
I'm a bit confused...
I have a typical procedure where:
for nJ := 0 to DBGrid1.SelectedRows.Count-1 Do Begin
      DBGrid1.DataSource.DataSet.GotoBookmark(pointer(DBGrid1.SelectedRows.Items[nJ]));

*Do some stuff to get data for a report*

      frxReport1.LoadFromFile('report.fr3');
      frxReport1.PrepareReport();
      frxReport1.PrintOptions.Printer := ComboBox1.Text;
      frxReport1.Print;

end;

Everything is fine untill I have more than one selection (for example 2-3 rows or whole grid).
In debug mode this loop runs once ok (SelectedRows.Count value is for example 3) and after going for another run it sets the Count value to 0 each time thus giving me Access Violation error.
It only happens on frxReport1.Print (same thing with frxReport1.Export(frxPDFExport1)).
If I remove anything related to printing or exporting loop runs fine till the end.

Funny thing is that I have old application in Delphi 2006 which runs fine and now this happened in Delphi 2010. Both are using FR 4.0.

Help > It drives me crazy.

Comments

  • edited 10:09AM
    I see that after calling frxReport1.Print; for first time it closes all my datasets... even the one not related to report itself.
    Never had such problem with fastreports before as I'm using same procedures:(
    When I //frxReport1.Print; from the loop/code everything works smooth.

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.