منظورتون همینه؟!
درضمن شما هیچ شرطی برای CheckBox ها تعیین نکرده بودید.
procedure TForm1.Button1Click(Sender: TObject);
var
s:string;
begin
S:='';
if (CheckBox1.Checked) And (edit1.Text<>'') then
s:='id_mosh LIKE Type1';
if (CheckBox2.Checked) And (edit3.Text<>'') then
begin
if S<>'' then
S:=S+' ' +'AND';
s:=S+' '+'id_BANK = Type2 ';
end;
if (CheckBox3.Checked) And (edit5.Text<>'') then
begin
if S<>'' then
S:=S+' ' +'AND';
s:=S+' '+'id_chek = Type3';
end;
if (CheckBox4.Checked) And (mas1.Text<>'') then
begin
if S<>'' then
S:=S+' ' +'AND';
s:=S+' '+'tar_sar >= Type4 And tar_sar <= Type5 ';
end;
if edit6.Text <> '' then
begin
IF S<>'' THEN
S:=S+' ' +'AND';
s:=S+' '+'mab >= Type6 And mab <= Type7 ';
end;
LABEL2.Caption:=S;
adq.SQL.Clear;
if S<>'' then
begin
adq.SQL.Add('select * from tbl_CHEK where'+' '+s );
if (CheckBox1.Checked) And (edit1.Text<>'') then
adq.Parameters.ParamByName('Type1').Value := Trim(Edit1.Text);
if (CheckBox2.Checked) And (edit3.Text<>'') then
adq.Parameters.ParamByName('Type2').Value := Trim(Edit3.Text);
if (CheckBox3.Checked) And (edit5.Text<>'') then
adq.Parameters.ParamByName('Type3').Value := Trim(Edit5.Text);
if (CheckBox4.Checked) And (mas1.Text<>'') then
begin
adq.Parameters.ParamByName('Type4').Value := Trim(mas1.Text);
adq.Parameters.ParamByName('Type5').Value := Trim(mas2.Text);
end;
if edit6.Text<>'' then
begin
adq.Parameters.ParamByName('Type6').Value := Trim(edit6.Text);
adq.Parameters.ParamByName('Type7').Value := Trim(edit7.Text);
end;
if s = '' then
end
else
adq.SQL.Add('select * from tbl_CHEK');// in code
adq.ExecSQL;
adq.Active := True;
end;
موفق باشید.