como mencione mi consulta es:
Código Delphi
[-]if Adotable1.Locate('fecha',lbl_fecha.Caption,[]) = false then
begin
AdoTable1.Filtered := False;
AdoTable1.Filtered := False;
Filtro := 'fecha = '+lbl_fecha.Caption;
AdoTable1.Filter := Filtro;
AdoTable1.Filtered := True;
AdoTable1.Open;
end
else
begin
AdoTable1.Filtered := False;
AdoTable1.Filtered := False;
Filtro := 'fecha = '+lbl_fecha.Caption;
AdoTable1.Filter := Filtro;
AdoTable1.Filtered := True;
AdoTable1.Open;
end;
pero donde coloco el codigo de la suma:
Código Delphi
[-]function SumarTotales(Grid: TDBGrid; const AFieldName: string): Currency;
var
BM: TBookMarkStr;
begin
Result:= 0;
with Grid.DataSource.DataSet do
begin
BM:= Bookmark;
DisableControls;
while not Eof do
begin
Result:= Result + FieldByName(AFieldName).AsCurrency;
Next;
end;
BookMark:= BM;
EnableControls;
end;
end;
y donde colo este otro codigo
Código Delphi
[-]Edit.Text:= FloatToStr(SumarTotales(DBGrid1,'Total'));
ya estuve intentando y me marca error