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

search on multiple keys

Status
Not open for further replies.

113983

Programmer
Jul 28, 2008
26
we have a file with customer name, phone number, description of job, contact name and want to build a search where user can type beginning letters (or numbers) and only items that match will show in grid. We can do this with one index but are looking for way to do it with index on each of these items. Any ideas?
 
I would use a select statement (you can use CursorAdapter, if you want) with parameters and LIKE clause, so your select statement will look like

select Fields from myTable where CustomerName LIKE ?m.CustomerName and Phone like ?m.Phone etc.

(you would add % at the end of your parameter when you set the parameter).
 
Don't worry about the indexes - Fox will decide whether or not it can make use of an index. If you're running the sort of query that markros suggests then you'll need to SET ORDER TO beforehand so that the query does not have to fight an imposed ordering of the records. Setting the table into CustomerName or Phone order won't help the query.

Geoff Franklin
 
I don't think you need to do SET ORDER TO prior to running SQL Select. The order of the table has no bearance for SQL Select since all tables are opened by the Query itself.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top