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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TEdit

Status
Not open for further replies.

heydyrtt

Programmer
Dec 12, 2001
63
US
What I'm doing, when I load a form, I'm not opening the table, this form is for modifying data thats already been posted to database. What I want to do is have a TEdit box, type in the ssn# then on exit open the table and go to that record indicated by whats in the TEdit. How do you do a lookup like this, if it matters I'm using MYSQL.


Thanks



Heydyrtt
 
This is similar to your earlier post. I've not used MySQL but if you are using something compatable with the VCL dataset you have two options, Locate, and Lookup. Locate will find the first matching record and return true. If nothing is found, it returns false. Lookup searchs and returns a Variant with the results of the lookup. I use these to find an item where these is only one item in table with that key, e.g. SSN.

A third option is to use a filter. I use filters to find multiple rows, e.g., LastName = Smith.

I personally prefer Locate or filters. Here is an example of using Locate:
Code:
TLocateOptions MySearchOpts; // Define options
MySearchOpts.Clear(); // Clear out memory location
MySearchOpts << loCaseInsensitive; // Upper and lower case OK
bool LocateOK = MyTable->Locate("SSN", FindSSNStr, MySearchOpts);

This will look up the field SSN in MyTable with a value of whatever is in FindSSNStr.

Clear as mud now? :)

James P. Cottingham

There's no place like 127.0.0.1.
There's no place like 127.0.0.1.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top