PrepareReport Error

edited 8:11PM in FastReport 4.0
Hello,


I have an invoice printing function snippet:

For i := 1 To CopyCount Do
Begin
Report.Script.Variables := 'Copy'+IntToStr(i) +'/'+IntToStr(MaxCoppy) ;

Report.PrepareReport;
Report.print;

End;

The customer prints invoices all day. About 3-5 times a day the following error occurs:
- The copy 1 will be printed (this is always good)
- When the software comes to the next copies (2nd, 3d, or 4th) to the point of "Report.PrepareReport;" it gives Access violation and sometimes "Exception: "Privileged instruction" error (I know for sure that PrepareReport causes the problem because I log everything in the program)
- If the customer doesn't quit the program, every next invoice printing would be the same: the first copy would be good, but the others would give exception
- If the customer quits the program, and starts it again, it will work for some time again


This problem doesn't occur at my computer (nor at the other customer's computers), only at the customers computers 3-5 times a day (he has 3 computers with different operation systems)

What can cause the problem? The customer is quite angry...



Comments

  • edited April 2012
    Memory problem?
    Insufficient memory (maybe a memory leak in FR) or memory which is suspect in a region which is only used on 2nd and subsequent prints.

    Everything points to thsi computer being the problem.
    How to convince the customer is another question.
  • edited 8:11PM
    technisoft wrote: »
    Memory problem?
    Insufficient memory (maybe a memory leak in FR) or memory which is suspect in a region which is only used on 2nd and subsequent prints.

    Everything points to thsi computer being the problem.
    How to convince the customer is another question.

    Hello,

    Thank you for the answer. What do you mean by thsi?
    Let's say there is a memory leak in Fr ... what can I check in the program?

    Some more info:

    - the TFrxReport is a global component
    - the TfrxMasterData is locally declared and created on the fly in the procedure
    - the two TfrxDBDatasets are also locally declared and created on the fly in the procedure
      Riport.DataSets.Clear;
    
      MainDataSet:= TfrxDBDataset.Create(nil);
      MainDataSet.UserName := 'frxInvoiceDataSet';
      MainDataSet.Enabled := true;
      MainDataSet.OpenDataSource := True;
      MainDataSet.DataSet := pMainDataSet;// parameter
    
      RowsDataSet:= TfrxDBDataset.Create(nil);
      RowsDataSet.UserName := 'frxInvoiceRowsDataSet';
      RowsDataSet.Enabled := true;
      RowsDataSet.OpenDataSource := True;
      RowsDataSet.DataSet := pRowsDataSet;//parameter
    
      Riport.DataSets.Add(MainDataSet);
      Riport.DataSets.Add(RowsDataSet);
    
      //-----------------------------------------
      DataBandMaster := Riport.FindObject('MasterData1') as TfrxMasterData;
      DataBandMaster.DataSet := RowsDataSet;
      //-----------------------------------------
    

  • edited 8:11PM
    Hello,

    Additional information to my previous post:

    The customer found a sheet with the following printed on it:

    Pcl XL error
    Subsystem: Kernel
    Error: Illegal Tag
    Operator: 0x60
    Position: 52

    I don't know if this error may be related to the problem above or not (but the same problem with the second prints persist if I use ShowReport instead of Print)
  • edited 8:11PM
    'thsi' was a typo, should be 'this'

    If you are using the right version of borlndmm.dll then you can set
    ReportMemoryLeaksOnShutdown := TRUE;
    and get a report of unreleased memory on program exit.

    I would try to work with a dynamically created TfxReport component for ever print job and should be relatively simple. It would make sure that TfrxReport is unaffected by previous jobs.
    You already create the TfrxDBDataSet dynamically, and I hope you free them in the end.

    The simplest and quickest way may be to swop or substitute the customer's computer, even if only temporarily. If the same program, same operator, same network connection, same printer then work fine, this should be sufficient proof to identify this particular computer as 'faulty'.
    if the problem also occurrs on the replacement computer then use a different printer. It wouldn't be the first time printer driver software plays up (also update printer driver).
  • edited 8:11PM
    technisoft wrote: »
    'thsi' was a typo, should be 'this'

    If you are using the right version of borlndmm.dll then you can set
    ReportMemoryLeaksOnShutdown := TRUE;
    and get a report of unreleased memory on program exit.

    I would try to work with a dynamically created TfxReport component for ever print job and should be relatively simple. It would make sure that TfrxReport is unaffected by previous jobs.
    You already create the TfrxDBDataSet dynamically, and I hope you free them in the end.

    The simplest and quickest way may be to swop or substitute the customer's computer, even if only temporarily. If the same program, same operator, same network connection, same printer then work fine, this should be sufficient proof to identify this particular computer as 'faulty'.
    if the problem also occurrs on the replacement computer then use a different printer. It wouldn't be the first time printer driver software plays up (also update printer driver).

    Hello,

    Thank you, I will try it!

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.