Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 138
  • Last Modified:

Filter using two text fields?

I need to be able to filter a table based on information taken from two edit.text boxes. How do I do this?
Cheers
Mike Ross
0
mykyl
Asked:
mykyl
1 Solution
 
333Commented:
Hi,
Use TQuery, not TTable.

i.e if Query1 is TQuery, then

procedure Form1.Button1Click(Sender:TObject);
begin
  if Query1.Active then Query1.Close;
  Query1.Sql.Clear;
  Query1.Sql.Add('select * from MyTable where Field1="'+Edit1.Text+'" and Field2="'+Edit2.Text+'"');
  Query1.Open;
end;

A.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now