Hola a todos tengo problemas con el filtrado, Me da error y no se como evitarlo obviemos la parte de la fecha que la pregunte en otro hilo pero no se si hice bien talvez la complique un poco, pero fue la unica forma que se me ocurrio si saben otra me dicen. Gracias saludos. El error es cdo chequeo algun componente y doy click en boton filtrar.
Código:
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 ='+ECLiente.text
else
temp:=temp+' and Telas.Cliente ='+ECLiente.text;
ECLiente.Clear;
end;
if cbpo.Checked=true then
begin
if temp='' then
temp:='Telas.PO ='+Epo.text
else
temp:=temp+' and Telas.PO ='+Epo.text;
EPO.Clear;
end;
if cbdetalle.Checked =true then
begin
if temp='' then
temp:='Telas.descripcion1 ='+Edit1.text
else
temp:=temp+' and Telas.descripcion1 ='+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 '+QuotedStr(temp)+')');
IBQInformes.Open;
end;