Fórum Evento OnCalcFields. Como usá-lo? #317126
22/03/2006
0
[Error] Unit1.pas(57): Incompatible types
[Fatal Error] Project2.dpr(5): Could not compile used unit ´Unit1.pas´
estou usando Delphi 7 e Paradox os Campos em questão são todos do tipo S.
Se alguem puder ajudar - Sou iniciante
Segue o código do programa:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls, DB, DBTables;
type
TForm1 = class(TForm)
Table1: TTable;
DataSource1: TDataSource;
Table1RELOGIO: TStringField;
Table1CONSUMIDOR: TStringField;
Table1PRECO_KILOWATE: TCurrencyField;
Table1LEITURA_ANTERIOR: TSmallintField;
Table1LEITURA_ATUAL: TSmallintField;
Table1CONSUMO_TOTAL: TSmallintField;
Table1CONSUMO_EXCEDIDO: TSmallintField;
Table1TOTAL_DA_FATURA: TSmallintField;
Table1DATA: TDateField;
Label1: TLabel;
DBEdit1: TDBEdit;
Label2: TLabel;
DBEdit2: TDBEdit;
Label3: TLabel;
DBEdit3: TDBEdit;
Label4: TLabel;
DBEdit4: TDBEdit;
Label5: TLabel;
DBEdit5: TDBEdit;
Label6: TLabel;
DBEdit6: TDBEdit;
Label7: TLabel;
DBEdit7: TDBEdit;
Label8: TLabel;
DBEdit8: TDBEdit;
Label9: TLabel;
DBEdit9: TDBEdit;
Table1TOTAL: TIntegerField;
procedure Table1CalcFields(DataSet: TDataSet);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Table1CalcFields(DataSet: TDataSet);
begin
Table1CONSUMO_TOTAL :=Table1LEITURA_ANTERIOR+Table1LEITURA_ATUAL;
end;
end.Ciro_cj
Curtir tópico
+ 0Posts
22/03/2006
Vinicius2k
Table1CONSUMO_TOTAL.Value := Table1LEITURA_ANTERIOR.Value + Table1LEITURA_ATUAL.Value;
Atenção ao [b:61fb25469b].Value[/b:61fb25469b] que é a propriedade do TField que contém o valor, propriamente dito.
Gostei + 0
23/03/2006
Paullsoftware
Table1CONSUMO_TOTAL.Value := Table1LEITURA_ANTERIOR.Value + Table1LEITURA_ATUAL.Value;
Gostei + 0
30/07/2007
Barretoee
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)