Error leaving the Formshow

Asked

Viewed 89 times

1

I’m trying to figure out a mistake that I don’t know exactly where it’s generated. whenever I have to open one of the screens of the system it passes by 2 Procedure, (I go through them just below) the First is the FormShow in it I call the other CalculaSaldoHonorario.

In CalculaSaldoHonorario I open a query and until then nothing goes wrong, leaving from CalculaSaldoHonorario he finishes the FormShow and soon after the end; of the error:

---------------------------
Debugger Exception Notification
---------------------------
Project MeuSistema.exe raised exception class EConvertError with message ''' is not a valid integer value'.
---------------------------
Break   Continue   Help   
---------------------------

I’m using the Unidac in my project.

Follows the codes:

procedure TfrmManutencaoHonorarios.CalculaSaldoHonorario;
var zTotReceber: Currency;
begin
  DataModuleGeral2.dtsVerPagamentos.Enabled := False;
  DataModuleGeral2.qryVerPagamentos.Close;
  DataModuleGeral2.qryVerPagamentos.SQL.Clear;

  DataModuleGeral2.qryVerPagamentos.SQL.Add('select * from PAGAMENTOS T1 where T1.NUMERO_PROCESSO = '+QuotedStr(dbeNumero_Processo.Text)+' order by T1.DATA_PAGTO');
  DataModuleGeral2.qryVerPagamentos.Open;

  // Soma os Pagamentos
  zTotPagto := 0;
  DataModuleGeral2.qryVerPagamentos.First;
  while not DataModuleGeral2.qryVerPagamentos.Eof do
  begin
    zTotPagto := zTotPagto + DataModuleGeral2.qryVerPagamentosVALOR_PAGTO.AsCurrency;
    DataModuleGeral2.qryVerPagamentos.Next;
  end;

  DataModuleGeral2.qryVerPagamentos.First;

  DataModuleGeral2.dtsVerPagamentos.Enabled := True;

  edtValorTotalPagto.Text := String(RightStr(AnsiString('            '+FormatFloat('#,###,###,##0.00', zTotPagto))  , 14));
  // Encontra o Total a Receber
  zTotReceber := DataModuleGeral.tbHonorariosVALOR_TOTAL.AsCurrency - zTotPagto;
  if zTotReceber < 0 then zTotReceber := 0;
  edtTotalReceber.Text    := String(RightStr(AnsiString('            '+FormatFloat('#,###,###,##0.00', zTotReceber)), 14));

end;

Code of FormShow

procedure TfrmManutencaoHonorarios.FormShow(Sender: TObject);
begin
  Left :=   0;
  Top  := 144;

  if DataModuleGeral.tbHonorarios.Active = True then
  begin
    DataModuleGeral.tbUsuarios.Open;
    DataModuleGeral.tbHonorarios.Last;
  end;

  VerificaProcessoContrato;

  btnPesquisar.SetFocus;
end; // Logo depois que passa por esse end da o erro!

In error it opens the source of System.SysUtils in that part:

procedure ConvertErrorFmt(ResString: PResStringRec; const Args: array of const); {$IFDEF ELF} local; {$ENDIF}
begin
  raise EConvertError.CreateResFmt(ResString, Args);
end;

I isolated the line of these two projects and put in step by step the Debug the error only occurs if opens the query, after I know CalculaSaldoHonorario not the error, just the error in the output of the OnShow and does not appear where it passes before going to the ConvertErrorFmt.

2 answers

3


Probably the error is occurring on account that at some point your Code is ordering something that is not accessible.

I have isolated the line of these two processes and put in step by step the Debug the error only occurs if you open the query, after you quit Calculasaldohonorario not of the error, only gives the error in the output of Onshow and does not appear where it passes before going to the Converterrorfmt.

Calmly review if in this process/ CalculaSaldoHonorario it may be that it should be linked with another routine that should be causing the error or some capo that should be with a data type declared and in your query is another.

This is a response based on past information on account of I don’t have enough data to verify the error.

-1

Good morning @Edu Mendonça.. everything’s tight..?? : ) Dude.. From what I can tell, I think it’s as follows:..:

  • obs 01) Within the Protocol CalculaSaldoHonorario when you open the Query is passing the '+QuotedStr(dbeNumero_Processo.Text)+' as Query parameter. If this object is empty.. Will give error.
  • obs 02) Within this process you use the Datamodulegeral. What if there are no Records? may give error too.

I may not have interpreted the code correctly.. but I think this is it. : ) When correct, put what was the mistake. :)

  • 1

    Quotedstr() Put " " in the process number to do the search will always have process number.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.