Solved

Filter using two text fields?

Posted on 1998-09-26
1
130 Views
Last Modified: 2010-04-06
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
Comment
Question by:mykyl
1 Comment
 
LVL 2

Accepted Solution

by:
333 earned 50 total points
ID: 1340886
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

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question