Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Difficult Question About Searching Multiple Records???

Status
Not open for further replies.

nikeloeleven

Programmer
Feb 15, 2005
32
0
0
GB
Hi there....

I have a table called TARGET.

Every school pupil has to set himself/herself 3 tasks....
Therefore, the key fields in this "target" table are Admission Number and Target Number....

I have added a search facility in my forms so that you can search for the targets....

you can either search by "admission number" or you can search by "forename & surname"

this problem isn't too hard if i was just trying to search for one record, but my problem is that each pupil will have 3 targets and therefore each pupil will have 3 records....

the search facility must therefore be able to display the details of ALL 3 Target RECORDS instead of just finding the first record and ending the process??

So basically to sum it up... i need a search facility that searches for all the matches in a table instead of just ending the process after finding the first record that matches the search....

thnx a lot ppl:) i really appreciate your help...
 
Hi.
I don't really see the problem here.
Just write a SQL query that will retrieve the 3 records, and just loop through the recordset.

(Stuck in a schoolwork?)

KungTure-RX.jpg

//Nordlund
 
hi.... well i could use the sql statements to do this but i've been told that this requires me to fiddle about with the dataset quite a bit? is this true????

also, in order to use the sql statements in my delphi program, do i have to use some special feature or can i simply just add in the sql statements???
 
You could use the form wizard in the Database Menu to generate forms + queries.

If you are using the BDE with Paradox, you can also use the database desktop to mount and test the query, click on the show sql button and copy-paste the text in your Delphi query.

Steven van Els
SAvanEls@cq-link.sr
 
if you want to get anywhere with handling data, then you need to get to grips with SQL.

Either use the SQL property of the TQuery if you are not going to change the SQL each time you run it.

Of you can do it programatically, for example:

with quGeneral do begin
if active then close;
SQL.clear;
SQL.add('select * from CompanyCategory C, luCategory L where C.Category = L.category and C.address_ID = ' + IntToStr(FAddress_ID) + ' and L.Business_List = 1');
open;
end;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top