I have an adotable and i want to apply multiple filter from multiple coboboxes, each combobox applies a filter to that table. My problem is whenever i choose an item from combobox1 for example it applies its filter but when i choose another item from the next combobox which is combobox2 it deletes the previous filter(combobox1) and applies the filter from combobox2. My question is: how can i make the adotable keep the previous filters from combobox1 or combobox2 or even both but also adds the 3rd filter from combobox3 for more in-depth sorting? Thanks in advance. This is what i got to so far:
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
ADOTable1.Filtered:=false;
ADOTable1.filter:='`enter code here`field1='+ QuotedStr(ComboBox1.Text);
ADOTable1.Filtered:=true;
end;
procedure TForm1.ComboBox2Change(Sender: TObject);
begin
ADOTable1.Filtered:=false;
ADOTable1.filter:=adotable1.Filter+'and field2='+ QuotedStr(ComboBox1.Text);
ADOTable1.Filtered:=true;
end;
procedure TForm1.ComboBox3Change(Sender: TObject);
begin
ADOTable1.Filtered:=false;
ADOTable1.filter:=adotable1.Filter+'and field3='+ QuotedStr(ComboBox1.Text);
ADOTable1.Filtered:=true;
end;
above code is error when you changed many times,so you need to re-combin the filter text every times