Quiero para seleccionar las letras también, ya que estas en el botón
Así lo hice, pero no funcionó
procedure TForm1.FilterLetras(qQuery: TADOQuery; sLetraIni, sLetraFin: String); begin with qQuery do begin Close; SQL.Clear; SQL.Add(' SELECT * FROM TABLA WHERE (CAMPO >= :INI AND CAMPO <= :FIM) OR (CAMPO LIKE :FIM) '); SQL.Add(' ORDER BY CAMPO '); Parameters.ParamByName('INI').Value := sLetraIni; Parameters.ParamByName('FIM').Value := sLetraFin +'%'; Open; end; end;
Estoy llamando de esta manera
procedure TForm1.SpeedButton1Click(Sender: TObject); begin FilterLetras(ADOQuery1,'A','B'); end; procedure TForm1.SpeedButton2Click(Sender: TObject); begin FilterLetras(ADOQuery1,'C','D'); end; procedure TForm1.SpeedButton3Click(Sender: TObject); begin FilterLetras(ADOQuery1,'E','F'); end; procedure TForm1.SpeedButton4Click(Sender: TObject); begin FilterLetras(ADOQuery1,'G','H'); end; procedure TForm1.SpeedButton5Click(Sender: TObject); begin FilterLetras(ADOQuery1,'I','J'); end; procedure TForm1.SpeedButton6Click(Sender: TObject); begin FilterLetras(ADOQuery1,'K','L'); end; procedure TForm1.SpeedButton7Click(Sender: TObject); begin FilterLetras(ADOQuery1,'M','N'); end; procedure TForm1.SpeedButton8Click(Sender: TObject); begin FilterLetras(ADOQuery1,'O','P'); end; procedure TForm1.SpeedButton9Click(Sender: TObject); begin FilterLetras(ADOQuery1,'Q','R'); end; procedure TForm1.SpeedButton10Click(Sender: TObject); begin FilterLetras(ADOQuery1,'S','T'); end; procedure TForm1.SpeedButton11Click(Sender: TObject); begin FilterLetras(ADOQuery1,'U','V'); end; procedure TForm1.SpeedButton12Click(Sender: TObject); begin FilterLetras(ADOQuery1,'X','W'); end; procedure TForm1.SpeedButton13Click(Sender: TObject); begin FilterLetras(ADOQuery1,'Y','Z'); end; procedure TForm1.SpeedButton14Click(Sender: TObject); begin FilterLetras(ADOQuery1,'0','9'); end;
Saludos