Unanswered: Search for records containing text in a text box fields
Help please with building a search box on a form.
I'd like the user to be able to combine
1. an option group that will pick one of three fields containing a "TYPE"
2. enter a text phrase in textbox1 that will find all records that contain any part of the entered text and if the user wants -
3. enter a text in textbox2 to narrow down the search....
or do you have a better way - like the google search box - enter any number of words (ok - I could limit the number to four) to search for a record (On Field DESCRIPTION) to find ALL records that contain all the words or parts of those words somewhere in the DESCRIPTION.
I think that what's needed is to build the recordsource using the "LIKE *textbox2*" AND "LIKE *textbox2*" or something like that.....
Using timer control of 100ms in key phrase on a text box it will enable.
using sql queary like: "SELECT customer*.customer WHERE customer.customer_id= ' " & txtfind.text & " ';"
when record found timer will stop.
I think it will help you with key phrase
maruful_islam: Using the timer to repeatedly SELECT data every 100 ms really is NOT kind to the database... I would not reccomend this approach...
ArthurE212:What database are you using?
Standard wildcards in SQL are the underscore (_) for a single character match, and the percent (%) for any number of characters.
You best bet is to build a stored procedure in the database server, and pass it the parameters.
It can then separate the words in the first textbox, build a query with a where clause of [code]WHERE (TextField Like '%word1%' or TextField Like '%word2%' or ... ) AND TextField Like '%SupplementalWord%'
The stored procedure can then return the records matching the search criteria to the client.
edit=loquinWhoops. Didn't notice that Arthur posted his initial question 2.5 years ago... Then, checked his profile to see that he hasn't been back since...
Last edited by loquin; 08-27-09 at 15:44.
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert