LoadFromFile

originally the code was:
Report.LoadFromFile('C:\SimpleLandlord\ReportFiles\' + ReportName + '.fr3');

and was working. Something must have changed because this code starting getting:

Debugger Exception Notification
Project SimpleLandlord.exe raised exception class EOSError with message 'System Error. Code: 5.
Access is denied'.
Break Continue Help

So I changed it to:
  aReportFile := 'c:\temp\' + ReportName + '.fr3';
  if (FileExists(aReportFile)) then
  begin
    attrs := FileGetAttr(aReportFile);
    if attrs and 1 > 0 then
      MessageDlg('Read only', mtInformation, [mbOK]);
    Report.LoadFromFile(aReportFile);
  end;

to make sure the file is readable, but I still get the same message. Any ideas. Or anything I should try.
BTW. I have rebooted, and tried running as admin.

Comments

  • gpigpi
    edited 5:42AM
    Can you create small demo project with error?
  • edited 5:42AM
    I had accidentally created a dialog page. I couldn't delete it but when I deleted it out of the fr3 file it worked

    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <TfrxReport Version="5.6" DotMatrixReport="False" IniFile="\Software\Fast Reports" PreviewOptions.Buttons="4095" PreviewOptions.Zoom="1" PrintOptions.Printer="Default" PrintOptions.PrintOnSheet="0" ReportOptions.CreateDate="42839.5002059028" ReportOptions.Description.Text="" ReportOptions.LastChange="42841.4614366667" ScriptLanguage="PascalScript" ScriptText.Text="
    begin
    
    end.">
      <TfrxDataPage Name="Data" Height="1000" Left="0" Top="0" Width="1000"/>
      <TfrxReportPage Name="Page1" PaperWidth="215.9" PaperHeight="279.4" PaperSize="1" LeftMargin="11.6416666666667" RightMargin="11.6416666666667" TopMargin="11.6416666666667" BottomMargin="11.6416666666667" ColumnWidth="0" ColumnPositions.Text="" HGuides.Text="" VGuides.Text="">
        <TfrxMasterData Name="MasterData1" FillType="ftBrush" FillGap.Top="0" FillGap.Left="0" FillGap.Bottom="0" FillGap.Right="0" Height="192" Left="0" Top="16" Width="728.000470166667" ColumnWidth="0" ColumnGap="0" RowCount="0">
          <TfrxMemoView Name="Memo2" Left="519.15603" Top="7.77953" Width="189" Height="24" Font.Charset="0" Font.Color="0" Font.Height="-19" Font.Name="Calibri" Font.Style="1" ParentFont="False" Text="Late Rent Invoice"/>
          <TfrxShapeView Name="Shape1" Left="520" Top="61" Width="206" Height="16" Fill.BackColor="-16777194"/>
          <TfrxLineView Name="Line1" Left="520" Top="97" Width="206" Height="0" Color="0" Frame.Typ="4"/>
          <TfrxLineView Name="Line2" Left="520" Top="77" Width="0" Height="20" Color="0" Frame.Typ="1"/>
          <TfrxLineView Name="Line3" Left="726" Top="77" Width="0" Height="20" Color="0" Frame.Typ="1"/>
          <TfrxLineView Name="Line4" Left="623" Top="61" Width="0" Height="36" Color="0" Frame.Typ="1"/>
          <TfrxShapeView Name="Shape2" Left="602" Top="132" Width="124" Height="16" Fill.BackColor="15000804"/>
          <TfrxMemoView Name="Memo3" Left="528" Top="61" Width="68" Height="16" Font.Charset="1" Font.Color="0" Font.Height="-13" Font.Name="Arial" Font.Style="0" HAlign="haCenter" ParentFont="False" Text="Date"/>
          <TfrxMemoView Name="Memo4" Left="636" Top="61" Width="80" Height="16" Font.Charset="1" Font.Color="0" Font.Height="-13" Font.Name="Arial" Font.Style="0" HAlign="haCenter" ParentFont="False" Text="Amount Due"/>
          <TfrxMemoView Name="Memo5" Left="0" Top="16" Width="487" Height="16" Font.Charset="1" Font.Color="0" Font.Height="-13" Font.Name="Arial" Font.Style="0" ParentFont="False" Text="Return Name"/>
          <TfrxShapeView Name="Shape3" Left="602" Top="148" Width="124" Height="20"/>
          <TfrxMemoView Name="Memo6" Left="604" Top="133" Width="120" Height="15" Font.Charset="1" Font.Color="0" Font.Height="-13" Font.Name="Arial" Font.Style="0" Fill.BackColor="-16777194" HAlign="haCenter" ParentFont="False" Text="Amount Remmitted"/>
        </TfrxMasterData>
        <TfrxPageFooter Name="PageFooter1" FillType="ftBrush" FillGap.Top="0" FillGap.Left="0" FillGap.Bottom="0" FillGap.Right="0" Height="20" Left="0" Top="348" Width="728.000470166667">
          <TfrxMemoView Name="Memo1" Left="665.19728" Top="0" Width="75.5906" Height="18.89765" HAlign="haRight" Text="[Page#]"/>
        </TfrxPageFooter>
        <TfrxDetailData Name="DetailData1" FillType="ftBrush" FillGap.Top="0" FillGap.Left="0" FillGap.Bottom="0" FillGap.Right="0" Height="20" Left="0" Top="268" Width="728.000470166667" ColumnWidth="0" ColumnGap="0" RowCount="0"/>
        <TfrxHeader Name="Header1" FillType="ftBrush" FillGap.Top="0" FillGap.Left="0" FillGap.Bottom="0" FillGap.Right="0" Height="20" Left="0" Top="228" Width="728.000470166667">
          <TfrxShapeView Name="Shape4" Left="0" Top="0" Width="728" Height="16" Fill.BackColor="-16777194"/>
          <TfrxMemoView Name="Memo7" Left="604" Top="0" Width="120" Height="16" Font.Charset="1" Font.Color="0" Font.Height="-13" Font.Name="Arial" Font.Style="0" HAlign="haCenter" ParentFont="False" Text="Balance"/>
          <TfrxLineView Name="Line5" Left="600" Top="0" Width="0" Height="16" Color="0" Frame.Typ="1"/>
          <TfrxMemoView Name="Memo8" Left="504" Top="0" Width="91" Height="16" Font.Charset="1" Font.Color="0" Font.Height="-13" Font.Name="Arial" Font.Style="0" HAlign="haCenter" ParentFont="False" Text="Payments"/>
          <TfrxLineView Name="Line6" Left="500" Top="0" Width="0" Height="16" Color="0" Frame.Typ="1"/>
          <TfrxMemoView Name="Memo9" Left="404" Top="0" Width="91" Height="16" Font.Charset="1" Font.Color="0" Font.Height="-13" Font.Name="Arial" Font.Style="0" HAlign="haCenter" ParentFont="False" Text="Charged"/>
          <TfrxLineView Name="Line7" Left="400" Top="0" Width="0" Height="16" Color="0" Frame.Typ="1"/>
          <TfrxMemoView Name="Memo10" Left="4" Top="0" Width="52" Height="16" Font.Charset="1" Font.Color="0" Font.Height="-13" Font.Name="Arial" Font.Style="0" HAlign="haCenter" ParentFont="False" Text="Date"/>
          <TfrxLineView Name="Line8" Left="60" Top="0" Width="0" Height="16" Color="0" Frame.Typ="1"/>
        </TfrxHeader>
      </TfrxReportPage> 
    DELETE THIS>>>>>>>>  <TfrxDialogPage Name="DialogPage1" Font.Charset="1" Font.Color="0" Font.Height="-11" Font.Name="Tahoma" Font.Style="0" Height="200" ClientHeight="161" Left="265" Top="150" Width="300" ClientWidth="284"/><<<<<<<
    </TfrxReport>
    
  • gpigpi
    edited 5:42AM
    Works OK for me. See a small demo project in the attach

Leave a Comment