Question

Programming error in Delphi - Exception class EConvertError with message  is not a valid integer value.

Asked by: dylciara

I have created a database like program in the language pascal / delphi. The program has been working yesterday, until today, when I started it, an error message appeared .  is not a valid integer value. The program then continues to work.

I have not altered the code and the only thing that I can think might have triggered the problem is that certain algorithms begin on the first day of the month - mainly transferring completed records into another table. These algorithms have been working on previous months.

Please help. I have included the code on the opening form - the form in which the problem occurs every time the form is activated.

unit EtempaMain;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, jpeg, ExtCtrls;
 
type
  TfrmEtempaMain = class(TForm)
    ecommercebanner: TImage;
    webdesignbanner: TImage;
    imgButtonCloseDown: TImage;
    imgButtonClose: TImage;
    procedure imgButtonCloseMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure imgButtonCloseClick(Sender: TObject);
    procedure ecommercebannerClick(Sender: TObject);
    procedure webdesignbannerClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure imgButtonCloseMouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  end;
 
  EcommerceClientRecord = record {Declare EcommerceClient record}
    ClientID : string[6];
    FirstName, Surname, Address1, Address2, Town, County, Email : string[40];
    Postcode : string[9];           {Declare field names}
    PhoneNumber : string[12];
    CommissionRate : integer;
  end;
 
  EcommerceItemsRecord = record   {Declare EcommerceItems record}
    ClientID, ItemID : string[6];
    ItemName : string[40];
    TimesListed, Weight : integer; {Declare field names}
    DateListed : string[10];
    Picture, Invoiced, Finished : boolean;
    ListingFee, SalePrice, Postage, ActualPostage, FinalAmount, EtempaFee,
    ClientsAmount : real;
  end;
 
  EcommerceSalesRecord = record       {Declare EcommerceSales record}
    ClientID, ItemID : string[6];
    ItemName : string[40];
    DateListed : string[10];   {Declare field names}
    TimesListed : integer;
    FinalAmount, EtempaFee : real;
  end;
 
  EcommerceTakingsRecord = record   {Declare EcommerceTakings record}
    April, May, June, July, August, September, October, November, December,
    January, February, March, YearlyTotal : real;  {Declare field names}
    Year : integer;
  end;
 
  EcommerceExpensesRecord = record   {Declare EcommerceExpenses record}
    Date : TDateTime;
    ExpenseType : string [12];
    ExpenseName : string [20];
    ExpenseAmount : real;        {Declare field names}
  end;
 
  WebDesignClientRecord = record    {Declare WebDesignClient record}
    ClientID : string[6];
    FirstName, Surname, Address1, Address2, Town, County, Email : string[40];
    Postcode : string[9];         {Declare field names}
    PhoneNumber : string[12];
  end;
 
  WebDesignWebsiteRecord = record       {Declare WebDesignWebsite record}
    ClientID, WebsiteID : string[6];
    WebAddress, WebsiteName : string[40];
    BeginDate : TDateTime;
    WebsitePrice, DepositAmount : real;{Declare field names}
    WebsiteStatus : string[30];
    DepositReceived, PaymentReceived, Completed, EtempaFamily : boolean;
    WebPackage : string[15];
  end;
 
  WebDesignServerRecord = record      {Declare WebDesignServer record}
    WebsiteID, ServerID : string[6];
    DomainName, DomainPassword, UserName, Password, DomainHoster : string[20];
    HostingPrice, DomainPrice, TotalPrice : real;  {Declare field names}
    HomeHosted, TransferComplete : boolean;
    OpenAccountDate : string[10];
    WebHoster : string[40];
  end;
 
  WebDesignFamilyRecord = record       {Declare WebDesignFamily record}
    ClientID, WebsiteID, ServerID : string[6];
    WebAddress, WebHoster,WebsiteName : string[40];
    Claims : integer;
    DateJoined, PaymentDue : TDateTime;    {Declare field names}
    PaymentReceived : boolean;
  end;
 
  WebDesignOldSitesRecord = record      {Declare WebDesignOldSites record}
    ClientID, WebsiteID : string[6];
    WebAddress, WebHoster,WebsiteName : string[40];
    BeginDate, DateAdded : TDateTime;           {Declare field names}
    WebsitePrice : real;
    WebPackage : string[15];
  end;
 
  WebDesignTakingsRecord = record    {Declare WebDesignTakings record}
    April, May, June, July, August, September, October, November, December,
    January, February, March, YearlyTotal : real;  {Declare field names}
    Year : integer;
  end;
 
var
  frmEtempaMain: TfrmEtempaMain;
  EClient : EcommerceClientRecord;
  EClientFile : file of EcommerceClientRecord;
  EItems : EcommerceItemsRecord;
  EItemsFile : file of EcommerceItemsRecord;
  ESales : EcommerceSalesRecord;
  ESalesFile : file of EcommerceSalesRecord;
  ETakings : EcommerceTakingsRecord;
  ETakingsFile : file of EcommerceTakingsRecord;
  EExpenses : EcommerceExpensesRecord;
  EExpensesFile : file of EcommerceExpensesRecord;
  WDClient : WebDesignClientRecord;
  WDClientFile : file of WebDesignClientRecord;
  WDWebsite : WebDesignWebsiteRecord;
  WDWebsiteFile : file of WebDesignWebsiteRecord;
  WDServer : WebDesignServerRecord;
  WDServerFile : file of WebDesignServerRecord;
  WDFamily : WebDesignFamilyRecord;
  WDFamilyFile : file of WebDesignFamilyRecord;
  WDOldSites : WebDesignOldSitesRecord;
  WDOldSitesFile : file of WebDesignOldSitesRecord;
  WDTakings : WebDesignTakingsRecord;
  WDTakingsFile : file of WebDesignTakingsRecord;
  EClientIDIntFile : file of integer;
  EClientInt : integer;
  EItemIDIntFile : file of integer;
  EItemInt : integer;
  WDClientIDIntFile : file of integer;
  WDClientInt : integer;
  WDWebsiteIDIntFile : file of integer;
  WDWebsiteInt : integer;
  WDServerIDIntFile : file of integer;
  WDServerInt : integer;
  LastDateFile : file of TDateTime;
  LastDate : TDateTime;
  StartDir : string;
  FolderDir : string;
  Year : word;
 
implementation
 
uses Ecommerce, WebDesign;
 
{$R *.dfm}
 
procedure TfrmEtempaMain.ecommercebannerClick(Sender: TObject);
begin
  frmEtempaMain.visible := false;  {Close EtempaMain form}
  frmEcommerce.show;       {Go to Ecommerce form}
end;
 
procedure TfrmEtempaMain.FormActivate(Sender: TObject);
var
  RecordPosition, TransferNumber, TakingsRecordPosition, YearInt,
  SalesRecordPosition, SalesMonthInt, SalesYearInt, DeleteNumber,
  SitesDeleteNumber, OldSitesRecordPosition, OldSitesYearInt, OldSitesMonthInt,
  MonthInt : integer;
  DateListedYear, DateListedMonth, SalesMonth, SalesYear, OldSitesYear,
  OldSitesMonth, DateAddedString, WebsiteNotesFileName : string;
  Profit, TempProfit, YearlyTotalAmount : real;
  Year, Month, Day, LastYear, LastMonth, LastDay : Word;
begin
  reset (LastDateFile);
  read (LastDateFile, LastDate);
  decodedate (LastDate, LastYear, LastMonth,LastDay);{Get LastDate and split up}
  closefile (LastDateFile);
 
  decodedate (Date, Year, Month, Day); {Get Today's Date and split up}
 
  if (Month > LastMonth) or (Year > LastYear) then {If it is next month}
    begin
      TransferNumber := 0;   {Set initial values}
      RecordPosition := -1;
 
      reset(EItemsFile);
 
      while (not EOF(EItemsFile)) do
        begin
          read(EItemsFile, EItems); {Read EItems record}
          inc(RecordPosition);        {Increase RecordPosition by 1}
 
          if EItems.Invoiced = true then     {If it has been invoiced}
            begin
             inc (Transfernumber); {Increase TransferNumber by 1}
 
             ESales.ClientID := EItems.ClientID;
             ESales.ItemID := EItems.ItemID;  {Assign values to ESalesFile}
             ESales.ItemName := EItems.ItemName;
             ESales.DateListed := EItems.DateListed;
             ESales.TimesListed := EItems.TimesListed;
             ESales.FinalAmount := EItems.FinalAmount;
             ESales.EtempaFee := EItems.EtempaFee;
 
             Profit := EItems.EtempaFee;   {Get Profit value from EItems file}
 
             reset (ESalesFile);
             seek (ESalesFile, FileSize(ESalesFile));
             write (ESalesFile, ESales);  {Write a new record to ESalesFile}
             closefile(ESalesFile);
 
             DateListedYear:=copy(EItems.DateListed,7,4);
             YearInt := strtoint(DateListedYear);     {Get DateListed Year}
 
             DateListedMonth:=copy(EItems.DateListed,4,2);{Get DateListed Month}
             MonthInt := strtoint(DateListedMonth);     {Get DateListed Month}
 
             TakingsRecordPosition := -1; {Set initial value}
 
             reset (ETakingsFile);
             while (not EOF(ETakingsFile)) do
               begin
                 read(ETakingsFile, ETakings); {Read ETakings file record}
                 inc(TakingsRecordPosition);{Increase TakingsRcordPosition by 1}
 
                 if ETakings.Year = YearInt then {If it is the same year}
                   begin
                     YearlyTotalAmount := ETakings.YearlyTotal
                     + Profit;{Recalculate YearlTotalAmount}
 
                     ETakings.YearlyTotal :=
                     YearlyTotalAmount;{Assign YearlyTotalAmount to TakingsFile}
 
                     case MonthInt of
                       1 : begin      {If Month is Jan}
                             TempProfit := Profit + ETakings.January;
                             ETakings.January :=
                             TempProfit;{Assign Jan's Profit to TakingsFile}
                           end;
 
                       2 : begin {If Month is Feb}
                             TempProfit := Profit + ETakings.February;
                             ETakings.February :=
                             TempProfit; {Assign Feb's Profit to TakingsFile}
                           end;
 
                       3 : begin {If Month is Mar}
                             TempProfit := Profit + ETakings.March;
                             ETakings.March :=
                             TempProfit; {Assign Mar's Profit to TakingsFile}
                           end;
 
                       4 : begin {If Month is Apr}
                            TempProfit := Profit + ETakings.April;
                            ETakings.April :=
                            TempProfit; {Assign Apr's Profit to TakingsFile}
                           end;
 
                       5 : begin {If Month is May}
                             TempProfit := Profit + ETakings.May;
                             ETakings.May :=
                             TempProfit; {Assign May's Profit to TakingsFile}
                           end;
 
                       6 : begin {If Month is Jun}
                             TempProfit := Profit + ETakings.June;
                             ETakings.June :=
                             TempProfit; {Assign Jun's Profit to TakingsFile}
                           end;
 
                       7 : begin {If Month is Jul}
                             TempProfit := Profit + ETakings.July;
                             ETakings.July :=
                             TempProfit; {Assign Jul's Profit to TakingsFile}
                           end;
 
                       8 : begin {If Month is Aug}
                             TempProfit := Profit + ETakings.August;
                             ETakings.August :=
                             TempProfit; {Assign Aug's Profit to TakingsFile}
                           end;
 
                       9 : begin {If Month is Sep}
                             TempProfit := Profit + ETakings.September;
                             ETakings.September :=
                             TempProfit; {Assign Sep's Profit to TakingsFile}
                           end;
 
                       10 : begin {If Month is Oct}
                              TempProfit := Profit + ETakings.October;
                              ETakings.October :=
                              TempProfit; {Assign Oct's Profit to TakingsFile}
                            end;
 
                       11 : begin {If Month is Nov}
                              TempProfit := Profit + ETakings.November;
                              ETakings.November :=
                              TempProfit; {Assign Nov's Profit to TakingsFile}
                            end;
 
                       12 : begin {If Month is Dec}
                              TempProfit := Profit + ETakings.December;
                              ETakings.December :=
                              TempProfit; {Assign Dec's Profit to TakingsFile}
                            end;
                     end;  {case}
 
                     seek (ETakingsFile, TakingsRecordPosition);
                     write(ETakingsFile, ETakings);{Rewrite record to ETakings}
                   end;
                 {end if}
               end;
             {end while}
             closefile(ETakingsFile);
 
             seek (EItemsFile, FileSize(EItemsFile) - 1);
             read (EItemsFile, EItems);
             seek (EItemsFile, RecordPosition);
             write (EItemsFile, EItems);
             seek (EItemsFile, FileSize(EItemsFile) - 1);
             truncate (EItemsFile); {Replace deleted record with last record}
 
             seek (EItemsFile, RecordPosition); {Go back to last record}
             dec (RecordPosition); {Decrease recordposition}
            end;
          {end if}
        end;
      {end while}
 
      if TransferNumber > 0 then   {If any records have been transfered}
        messagedlg ('You Have Transferred ' + inttostr(TransferNumber) +
        ' Records From the Items Table.', mtInformation, [mbOK],
        0);   {Send an information message to confirm transfer}
      {end if}
 
      closefile(EItemsFile);
    end;
  {end if}
 
  DeleteNumber := 0; {Set initial values}
  SalesRecordPosition := -1;
 
  reset (ESalesFile);
  while not EOF (ESalesFile) do
    begin
      read (ESalesFile, ESales); {Read EItems record}
      inc (SalesRecordPosition);  {Increase SalesRecordPosition by 1}
 
      SalesMonth := copy(ESales.DateListed,4,2);
      SalesMonthInt := strtoint(SalesMonth); {Get DateListed Month}
 
      SalesYear := copy(ESales.DateListed,7,4);
      SalesYearInt := strtoint(SalesYear);   {Get DateListed Year}
 
      if (SalesMonthInt = 11)or(SalesMonthInt =12)then {If  Month is Nov or Dec}
        begin
          SalesMonthInt := 0;         {Month is 0}
          SalesYearInt := SalesYearInt + 1;  {Year Becomes Next Year}
        end;
      {end if};
 
      if (Month > SalesMonthInt + 1) and (Year > SalesYearInt)
      then {If it's a year and 3 months later}
        begin
          reset (ESalesFile);
          seek (ESalesFile, FileSize(ESalesFile) - 1);
          read (ESalesFile, ESales);
          seek (ESalesFile, SalesRecordPosition);
          write (ESalesFile, ESales);
          seek (ESalesFile, FileSize(ESalesFile) - 1);
          truncate (ESalesFile); {Replace deleted record with last record}
 
          seek (ESalesFile, SalesRecordPosition);  {Go back to last record}
          dec (SalesRecordPosition); {Decrease Salesrecordposition}
 
          inc (DeleteNumber);    {Increase DeleteNumber by 1}
        end;
      {end if}
    end;
  {end while}
  closefile (ESalesFile);
 
  if DeleteNumber > 0 then  {If records have been deleted}
    messagedlg (inttostr(DeleteNumber) + ' Old Sales Records Have Been Deleted!'
    , mtInformation, [mbOK], 0);{Send an information message to confirm delete}
  {end if}
 
  SitesDeleteNumber := 0;  {Set Initial Values}
  OldSitesRecordPosition := -1;
 
  reset (WDOldSitesFile);
  while not EOF (WDOldSitesFile) do
    begin
      read (WDOldSitesFile, WDOldSites); {Read WDOldSites record}
      inc (OldSitesRecordPosition);   {Increase OldSitesRecordPosition by 1}
 
      DateAddedString := datetostr(WDOldSites.DateAdded); {Get DateAdded}
 
      OldSitesMonth := copy(DateAddedString,4,2);
      OldSitesMonthInt := strtoint(OldSitesMonth);{Get DateAdded Month}
 
      if OldSitesMonth = '11' then     {If the Month is November}
        OldSitesMonth := '0'         {Month is 0}
      {end if};
 
      if OldSitesMonth = '12' then     {If the Month is December}
        OldSitesMonth := '-1'         {Month is -1}
      {end if};
 
      OldSitesYear := copy(DateAddedString,7,4);
      OldSitesYearInt := strtoint(OldSitesYear); {Get DateAdded Year}
 
      if (Month > OldSitesMonthInt + 1) and (Year > OldSitesYearInt)
      then      {If it's a year and 2 months later}
        begin
          WebsiteNotesFileName := FolderDir + WDOldSites.WebsiteID +
          '.txt'; {Create WebsiteNotesFileName}
 
          if FileExists(WebsiteNotesFileName) then  {If it exists}
            DeleteFile(WebsiteNotesFileName);    {Delete the file}
          {end if}
 
          reset (WDOldSitesFile);
          seek (WDOldSitesFile, FileSize(WDOldSitesFile) - 1);
          read (WDOldSitesFile, WDOldSites);
          seek (WDOldSitesFile, OldSitesRecordPosition);
          write (WDOldSitesFile, WDOldSites);
          seek (WDOldSitesFile, FileSize(WDOldSitesFile) - 1);
          truncate (WDOldSitesFile);{Replace deleted record with last record}
 
          seek (WDOldSitesFile, OldSitesRecordPosition);{Go back to last record}
          dec (OldSitesRecordPosition); {Decrease OldSitesrecordposition}
 
          inc (SitesDeleteNumber); {Increase SitesDeleteNumber by 1}
        end;
      {end if}
    end;
  {end while}
  closefile (WDOldSitesFile);
 
  if SitesDeleteNumber > 0 then     {If records have been deleted}
    messagedlg (inttostr(SitesDeleteNumber) +
    ' Old Site Records Have Been Deleted!' , mtInformation, [mbOK],
    0); {Send an information message to confirm delete}
  {end if}
 
  reset(LastDateFile);
  LastDate := Date;   {Get today's date}
  write(LastDateFile, LastDate);  {Save today's date}
  closefile(LastDateFile);
end;
 
procedure ETakingsFileSetUp;
begin
  ETakings.Year := Year;
  ETakings.January := 0.00;
  ETakings.February := 0.00;
  ETakings.March := 0.00;
  ETakings.April := 0.00;
  ETakings.May := 0.00;    {Assign value to ETakingsFile}
  ETakings.June := 0.00;
  ETakings.July := 0.00;
  ETakings.August := 0.00;
  ETakings.September := 0.00;
  ETakings.October := 0.00;
  ETakings.November := 0.00;
  ETakings.December := 0.00;
  ETakings.YearlyTotal := 0.00;
 
  seek (ETakingsFile, FileSize(ETakingsFile));
  write (ETakingsFile, ETakings);  {Write a new record to ETakingsFile}
end;
 
procedure WDTakingsFileSetUp;
begin
  WDTakings.Year := Year;
  WDTakings.January := 0.00;
  WDTakings.February := 0.00;
  WDTakings.March := 0.00;
  WDTakings.April := 0.00;
  WDTakings.May := 0.00;
  WDTakings.June := 0.00;
  WDTakings.July := 0.00;
  WDTakings.August := 0.00;
  WDTakings.September := 0.00;
  WDTakings.October := 0.00;
  WDTakings.November := 0.00;
  WDTakings.December := 0.00;
  WDTakings.YearlyTotal := 0.00;
  seek (WDTakingsFile, FileSize(WDTakingsFile));
  write (WDTakingsFile, WDTakings);
end;
 
procedure TfrmEtempaMain.FormCreate(Sender: TObject);
var
  Month, Day : word;
begin
  StartDir := GetCurrentDir;    {Get location of program}
  FolderDir := StartDir + '\WebsiteNotes\';  {Create WebsiteNotes address}
 
  assignfile(LastDateFile, 'lastdatefile.dat'); {Assign variable to file name}
  if not fileexists ('lastdatefile.dat')then  {If the file doesn't exist}
    begin
      LastDate := Date;     {Get today's date}
 
      rewrite (LastDateFile); {Create file}
      write(LastDateFile, LastDate);    {Write variable to file}
      closefile (LastDateFile);
    end
  {end if};
 
  assignfile (EClientFile, 'eclientfile.dat'); {Assign variable to file name}
  if not fileexists ('eclientfile.dat') then      {If the file doesn't exist}
    begin
      rewrite (EClientFile);  {Create file}
      closefile (EClientFile)
    end
  {endif};
 
  assignfile(EClientIDIntFile,'eclientidint.dat');{Assign variable to file name}
  if not fileexists ('eclientidint.dat') then       {If the file doesn't exist}
    begin
      EClientInt := 0;    {Set initial value}
 
      rewrite (EClientIDIntFile);  {Create file}
      write (EClientIDIntFile, EClientInt); {Write variable to file}
      closefile (EClientIDIntFile);
    end
  {endif};
 
  assignfile (EItemsFile, 'eitemsfile.dat'); {Assign variable to file name}
  if not fileexists ('eitemsfile.dat') then  {If the file doesn't exist}
    begin
      rewrite (EItemsFile);    {Create file}
      closefile (EItemsFile)
    end
  {endif};
 
  assignfile (EItemIDIntFile, 'eitemidint.dat');  {Assign variable to file name}
  if not fileexists ('eitemidint.dat') then   {If the file doesn't exist}
    begin
      EItemInt := 0;     {Set initial value}
 
      rewrite (EItemIDIntFile); {Create file}
      write (EItemIDIntFile, EItemInt);   {Write variable to file}
      closefile (EItemIDIntFile);
    end
  {endif};
 
  assignfile (ESalesFile, 'esalesfile.dat');  {Assign variable to file name}
  if not fileexists ('esalesfile.dat') then    {If the file doesn't exist}
    begin
      rewrite (ESalesFile); {Create file}
      closefile (ESalesFile)
    end
  {endif};
 
  assignfile (ETakingsFile, 'etakingsfile.dat');  {Assign variable to file name}
  if not fileexists ('etakingsfile.dat') then {If the file doesn't exist}
    begin
      rewrite (ETakingsFile);  {Create file}
      closefile (ETakingsFile)
    end
  {endif};
 
  decodedate (Date, Year, Month, Day); {Get Today's Date and split up}
 
  reset (ETakingsFile);
  if FileSize(ETakingsFile) = 0 then  {If ETakingsFile is empty}
    ETakingsFileSetUp;
  {end if}
 
  seek (ETakingsFile, FileSize(ETakingsFile) - 1); {Locate the last record}
  read (ETakingsFile, ETakings); {Read ETakings record}
 
  if Year > ETakings.Year then {If year is after the last year in ETakings file}
    ETakingsFileSetUp;
  {end if}
 
  assignfile (EExpensesFile, 'eexpensesfile.dat');  {Assign variable to file name}
  if not fileexists ('eexpensesfile.dat') then {If the file doesn't exist}
    begin
      rewrite (EExpensesFile);  {Create file}
      closefile (EExpensesFile)
    end
  {endif};
 
  assignfile (WDClientFile, 'wdclientfile.dat');{Assign variable to file name}
  if not fileexists ('wdclientfile.dat') then {If the file doesn't exist}
    begin
      rewrite (WDClientFile);  {Create file}
      closefile (WDClientFile)
    end
  {endif};
 
  assignfile(WDClientIDIntFile,'wclientidint.dat');{Assign variable to filename}
  if not fileexists ('wclientidint.dat') then {If the file doesn't exist}
    begin
      WDClientInt := 0;     {Set initial value}
 
      rewrite (WDClientIDIntFile);    {Create file}
      write (WDClientIDIntFile, WDClientInt);   {Write variable to file}
      closefile (WDClientIDIntFile);
    end
  {endif};
 
  assignfile (WDWebsiteFile, 'wdwebsitefile.dat');{Assign variable to file name}
  if not fileexists ('wdwebsitefile.dat') then {If the file doesn't exist}
    begin
      rewrite (WDWebsiteFile);    {Create file}
      closefile (WDWebsiteFile)
    end
  {endif};
 
  assignfile (WDWebsiteIDIntFile,'wdwebsiteidint.dat');{Assign var to file name}
  if not fileexists ('wdwebsiteidint.dat') then {If the file doesn't exist}
    begin
      WDWebsiteInt := 0;   {Set initial value}
 
      rewrite (WDWebsiteIDIntFile); {Create file}
      write (WDWebsiteIDIntFile, WDWebsiteInt);  {Write variable to file}
      closefile (WDWebsiteIDIntFile);
    end
  {endif};
 
  assignfile (WDServerFile, 'wdserverfile.dat');  {Assign variable to file name}
  if not fileexists ('wdserverfile.dat') then   {If the file doesn't exist}
    begin
      rewrite (WDServerFile);   {Create file}
      closefile (WDServerFile)
    end
  {endif};
 
  assignfile (WDServerIDIntFile, 'wdserveridint.dat');{Assign var to file name}
  if not fileexists ('wdserveridint.dat') then {If the file doesn't exist}
    begin
      WDServerInt := 0;  {Set initial value}
 
      rewrite (WDServerIDIntFile);   {Create file}
      write (WDServerIDIntFile, WDServerInt);   {Write variable to file}
      closefile (WDServerIDIntFile);
    end
  {endif};
 
  assignfile (WDFamilyFile, 'wdfamilyfile.dat'); {Assign variable to file name}
  if not fileexists ('wdfamilyfile.dat') then{If the file doesn't exist}
    begin
      rewrite (WDFamilyFile); {Create file}
      closefile (WDFamilyFile)
    end
  {endif};
 
  assignfile(WDOldSitesFile,'wdoldsitesfile.dat');{Assign variable to file name}
  if not fileexists ('wdoldsitesfile.dat') then{If the file doesn't exist}
    begin
      rewrite (WDOldSitesFile);  {Create file}
      closefile (WDOldSitesFile)
    end
  {endif};
 
  assignfile (WDTakingsFile, 'wdtakingsfile.dat');{Assign variable to file name}
  if not fileexists ('wdtakingsfile.dat') {If the file doesn't exist}
  then
    begin
      rewrite (WDTakingsFile); {Create file}
      closefile (WDTakingsFile)
    end
  {endif};
 
  reset (WDTakingsFile);
  if FileSize(WDTakingsFile) = 0 then  {If WDTakings file is empty}
    WDTakingsFileSetUp;
  {end if}
 
  seek (WDTakingsFile, FileSize(WDTakingsFile) - 1);  {Locate the last record}
  read (WDTakingsFile, WDTakings); {Read WDTakings record}
 
  if Year >WDTakings.Year then{If year is after the last year in WDTakings file}
    WDTakingsFileSetUp;
  {end if}
end;
 
procedure TfrmEtempaMain.imgButtonCloseClick(Sender: TObject);
begin
  close;     {Close program}
end;
 
procedure TfrmEtempaMain.imgButtonCloseMouseDown(Sender: TObject; Button:
TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  imgButtonClose.Visible := False;   {Switch images when hold button close down}
  imgButtonCloseDown.Visible := True;
end;
 
procedure TfrmEtempaMain.imgButtonCloseMouseUp(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  imgButtonClose.Visible := True;  {Switch images when release button close}
  imgButtonCloseDown.Visible := False;
end;
 
procedure TfrmEtempaMain.webdesignbannerClick(Sender: TObject);
begin
  frmWebDesign.show;   {Go to WebDesign form}
  frmEtempaMain.visible := false; {Close EtempaMain form}
end;
 
 
end.

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438:
439:
440:
441:
442:
443:
444:
445:
446:
447:
448:
449:
450:
451:
452:
453:
454:
455:
456:
457:
458:
459:
460:
461:
462:
463:
464:
465:
466:
467:
468:
469:
470:
471:
472:
473:
474:
475:
476:
477:
478:
479:
480:
481:
482:
483:
484:
485:
486:
487:
488:
489:
490:
491:
492:
493:
494:
495:
496:
497:
498:
499:
500:
501:
502:
503:
504:
505:
506:
507:
508:
509:
510:
511:
512:
513:
514:
515:
516:
517:
518:
519:
520:
521:
522:
523:
524:
525:
526:
527:
528:
529:
530:
531:
532:
533:
534:
535:
536:
537:
538:
539:
540:
541:
542:
543:
544:
545:
546:
547:
548:
549:
550:
551:
552:
553:
554:
555:
556:
557:
558:
559:
560:
561:
562:
563:
564:
565:
566:
567:
568:
569:
570:
571:
572:
573:
574:
575:
576:
577:
578:
579:
580:
581:
582:
583:
584:
585:
586:
587:
588:
589:
590:
591:
592:
593:
594:
595:
596:
597:
598:
599:
600:
601:
602:
603:
604:
605:
606:
607:
608:
609:
610:
611:
612:
613:
614:
615:
616:
617:
618:
619:
620:
621:
622:
623:
624:
625:
626:
627:
628:
629:
630:
631:
632:
633:
634:
635:
636:
637:
638:
639:
640:
641:
642:
643:
644:
645:
646:
647:
648:
649:
650:
651:
652:
653:
654:
655:
656:
657:
658:
659:
660:
661:
662:
663:
664:
665:
666:
667:
668:
669:
670:
671:
672:
673:
674:
675:
676:
677:
678:
679:
680:
681:
682:
683:
684:
685:
686:
687:
688:
689:
690:
691:
692:
693:
694:
695:
696:
697:
698:
699:
700:
701:
702:
703:
704:
705:
706:
707:
708:
709:
710:
711:
712:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-09-01 at 11:20:43ID24698916
Tags

Exception class EConvertError with message  is not a valid integer value

,

Delphi

,

Programming

,

database

Topics

Delphi Database

,

Algorithms

Participating Experts
1
Points
500
Comments
7

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Converting Pascal to Delphi
    Can I convert sources codes wroten in Turbo Pascal 6.0 to Delphi 2.0, and how?
  2. Pascal Units In Delphi!?
    Is it possible to use the procedures and functions of a pascal unit in Delphi? I know that it's not directly possible, but may be you have some idea about some indirect way, for example creating a dll file with Pascal and then call the dll from Delphi! Is this possible? If y...
  3. Integer?
    What exactly is an "Integer" and what does it mean in programming?
  4. Heap in pascal
    Hello. I need a simple implementation of a heap data structure in pascal. a node in the heap should contain an integer number. I need it to run some algorithms on it, and I'm not sure I can write it well myself. I need it in plain pascal and not Delphi. A source code pro...
  5. Delphi 7: const c:integer=1;
    Hello, with Delphi 4 so following is possible: procedure text; const c:integer=1; begin c:=2; //the new value of the constant c is 2 end; {c is a local variable with keeps its value til the next call of the procedure text} But this is not possible with Delphi7. H...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: 8080_DiverPosted on 2009-09-01 at 11:50:58ID: 25234696

Given that the error occurs every time the form is activated, have you considered setting a breakpoint at the start of that procedure, initiating the program from the IDE (in debug mode), and then walking through the procedure to see where the application is throwing the error?

 

by: dylciaraPosted on 2009-09-01 at 12:26:31ID: 25235023

I did that, the program runs fine until line 214, when the error starts occurring, however even when I commented out the four lines below that, the error message was still occurring, so its hard to pinpoint the exact lien of code which is the problem.

 

by: 8080_DiverPosted on 2009-09-01 at 12:43:43ID: 25235175

Put a break point on that line, which is, if I understand you correctly,

DateListedYear:=copy(EItems.DateListed,7,4);

Now, when you hit the breakpoint, you need to figure out what that line of data contains.  You may have to do this by finding enough identifying information to look at the source file or you may be able to do a <Ctrl><F7> to view the contents of EItems.DateListed.

Once you have that tid-bit of information, I am going to bet that there is an invalid character of some sort in columns 7-11 of the data.  

 

by: dylciaraPosted on 2009-09-01 at 13:03:45ID: 25235370

Wow, ye you're spot on. There is invalid data in there. For some reason, a record which holds the data EItems.Invoiced = false is getting through the if statement where EItems.Invoiced = true. The data that you can see from the break points confirms EItems.Invoiced = false. Is there an obvious hole in the if statement?

 

by: dylciaraPosted on 2009-09-01 at 13:08:10ID: 25235432

Actually, I have worked out the problem. It was a rogue record. Thanks very much for your help! Very much appriciated

 

by: dylciaraPosted on 2009-09-01 at 13:09:16ID: 31623169

Very much appreciated!

 

by: 8080_DiverPosted on 2009-09-01 at 13:26:43ID: 25235637

That's kind of what I was thinking but, not having the data available, I was trying to walk you through finding it. ;-)

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...