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!

Question About Searchin From Databases

Status
Not open for further replies.

nikeloeleven

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

I have a program in Delphi and an Interbase database linked... I have a datamodule (called unitDataModMain) where i keep the Interbase data connections....

I have a table called "Pupil" (the table connection is called tblPupil) which stores the details of pupils:

Amission Number
Forename
Surname
FormTutor

What I want to do is to be able to create a form that allows users to search for records within this Pupil table.

I will have a text box.... users will enter the data they want to search in this field

and on the click of a button... the TBDGRID (connected to tblPupil) should locate to the record with the data entered into the text box::: I know that the code added into the button could be something like this:
<table name>.Locate(<field string>,<search value>,<option set>);

Please help me on how to solve this problem...

Also... do you have any idea how i can search for a field in the tblPupil table and display the other feilds from that record into text boxes...

So for example, I could search for an Admission Number (e.g. admission number A11000) by typing the admission number into a text box... and on the click of a button... the fields of the rest of the record are shown on other text feilds such as the pupil number A11000's surname, forename and formtutor .... etc...?

Thanks a lot for your time ....
I really appreciate it.. thanks...
 
Check out the FAQ area

How do I quickly find data in a dbGrid?
faq102-4557

Steven van Els
SAvanEls@cq-link.sr
 
hi thanks for the help... I tried the FAQ but it didn't work...
on top of that... Delphi doesn't recognise "FindNearest" from:
try table1.FindNearest(edtSearch.text);
it says "undeclared identifier"....
Overall... the coding in the FAQ didn't work for me...

What I would like to solve is this bit:-

"do you have any idea how i can search for a field in the tblPupil table and display the other feilds from that record into text boxes...
So for example, I could search for an Admission Number (e.g. admission number A11000) by typing the admission number into a text box... and on the click of a button... the fields of the rest of the record are shown on other edit boxes such as pupil number A11000's surname, forename and formtutor .... etc...?"

Do you have any idea how I can do that bit please... Thanks a lot:)
 
The name of the TEditbox is edtSearch, convention used by Teixeira and Pacheco, authors of the Delphi 4 Developpers Guide


More info is also in the FAQ Area, topic Reference Material

Can you recommend any Delphi coding standards to adhere to?
faq102-3432 by Clive aka Stretchwickster

and


Steven van Els
SAvanEls@cq-link.sr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top