Funciono asi, probando lo hice andar pero realmente no fue algo que sabia, pero si alguien me lo puede explicar gracias
Cita:
procedure TFTodos.BFiltrarClick(Sender: TObject);
var
fecha:TDateTimeField;
temp:string;
begin
IBQInformes.Close;
temp:='';
IBQInformes.Sql.Clear;
if Cbvencidos.Checked=true then
begin
fecha.Value:=today;
temp:='Telas.FECHA_PROMETIDA > 20/09/2006';
end;
if Cbfaltantes.Checked=true then
if temp='' then
temp:='Telas.Cantidades_Faltantes > 0'
else
temp:=temp+' and Telas.Cantidades_Faltantes > 0';
If CBcliente.checked=true then
begin
if temp='' then
temp:='Telas.Cliente ='+Quotedstr(ECLiente.text)
else
temp:=temp+' and Telas.Cliente ='+Quotedstr(ECLiente.text);
ECLiente.Clear;
end;
if cbpo.Checked=true then
begin
if temp='' then
temp:='Telas.PO ='+Quotedstr(Epo.text)
else
temp:=temp+' and Telas.PO ='+Quotedstr(Epo.text);
EPO.Clear;
end;
if cbdetalle.Checked =true then
begin
if temp='' then
temp:='Telas.descripcion1 ='+Quotedstr(Edit1.text)
else
temp:=temp+' and Telas.descripcion1 ='+Quotedstr(Edit1.text);
Edit1.Clear;
end;
if temp='' then
IBQInformes.SQL.Add('SELECT * FROM Telas INNER JOIN Descripcion '+
'ON Telas.Descripcion1 = Descripcion.Descripcion')
else
IBQInformes.SQL.Add('SELECT * FROM Telas INNER JOIN Descripcion '+
'ON Telas.Descripcion1 = Descripcion.Descripcion where '+temp);
IBQInformes.Open;
end;
|