PrepareReport Error
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...
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
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
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)
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!