solucionado , gracias a vosotros ...
A lo mejor algun día aprendo y todo, exactamente el problema era que el else estaba ahi colgadito al final lo he dejado asi y funciona :
begin
// compruebo si lo quiere entre fechas o todo
if not checkbox2.Checked then
edit2.text:=form19.ADOTable1pendiente.AsString
else
// datasource2.DataSet.Refresh;
begin
button3.Visible:=true;
form5.DataSource2.DataSet.Filtered:=false;
form5.DataSource2.DataSet.Filter := 'codigo = '+QuotedStr (form19.adotable1codigo.value) + 'and fecha >=' + quotedstr(datetostr(datetimepicker1.Date)) + ' and fecha <=' + quotedstr(datetostr(datetimepicker2.Date)) ;
form5.DataSource2.DataSet.Filtered:=true;
dbgrid1.Refresh;
form5.adotable1.First;
sumador:= 0;
while not form5.adotable1.Eof do
begin
sumador:= sumador + form5.ADOTable1IMPORTE.AsInteger - form5.ADOTable1ADELANTO.AsInteger;
form5.datasource2.DataSet.Next;
end;
edit2.text:=inttostr(sumador);
qrlabel8.Caption:=edit2.Text;
qrlabel9.Caption:=edit2.Text;
Qrlabel11.Caption:=datetostr(datetimepicker1.Date);
Qrlabel12.Caption:=datetostr(datetimepicker2.Date);
Qrlabel16.Caption:=datetostr(datetimepicker1.Date);
qrlabel18.Caption:=datetostr(datetimepicker2.Date);
end;
end;
los qrlabel son para el informe impreso
prometo mejorar el tema indentado , gracias a todos por vuestro interés y amabilidad al contestar y preocuparos .
__________________
Porque las estirpes condenadas a cien años de soledad nunca tendran una segunda oportunidad sobre la tierra.
Gabriel Garcia Marquez (Cien años de Soledad).
|