Recent

Author Topic: external access violation with second time frreport1.PrepareReport  (Read 1030 times)

calm_sea

  • New Member
  • *
  • Posts: 39
external access violation with second time frreport1.PrepareReport
« on: September 14, 2022, 10:03:11 am »
Hello everybody. In my app, the first time it's executed frreport1.PrepareReport everything is ok. But the second time I get an "external access violation" error. I have made many attempt changing property and calling metods, but I cannot understand the cause.

dseligo

  • Hero Member
  • *****
  • Posts: 1196
Re: external access violation with second time frreport1.PrepareReport
« Reply #1 on: September 15, 2022, 12:35:08 am »
I suggest you prepare small project which shows that behavior. It would be best if you could do it without database connections/components.

calm_sea

  • New Member
  • *
  • Posts: 39
Re: external access violation with second time frreport1.PrepareReport
« Reply #2 on: September 15, 2022, 03:03:23 pm »
Okay I'll do it. In the meantime, I'll update you. I moved .loadfromfile to createform event, to make it run once, instead of every time. Now, I can create as many reports as I want without error, but, if I have created at least one, when I close the application I get the error access violation

calm_sea

  • New Member
  • *
  • Posts: 39
Re: external access violation with second time frreport1.PrepareReport
« Reply #3 on: September 15, 2022, 05:36:35 pm »
Ok. adding one piece at a time, it seems that the problem is caused by this code with which I add a logo to the report at run time

p:=TfrPictureView.Create(frReport1.Pages[pagina]);
p.CreateUniqueName;
p.SetBounds(20,40,143,80);
p.picture:=image1.Picture;

At the first run of showreport it is ok. At the second 'access violation'

calm_sea

  • New Member
  • *
  • Posts: 39
Re: external access violation with second time frreport1.PrepareReport
« Reply #4 on: September 17, 2022, 05:14:29 pm »
OK. I have found the problem. The correct code is:

p:=TfrPictureView.Create(frReport1.Pages[pagina]);
p.CreateUniqueName;
p.SetBounds(20,40,143,80);
p.picture.Assign(image1.Picture);

 

TinyPortal © 2005-2018