Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query with Containing
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00356777
Message ID:
00356794
Views:
10
>Using a text box for the user to input a search string, I want to run a query as they type against a table looking the string they have typed anywhere in the field, not just the starting with. Normally, all my searches use a grid with the ingrid, but to my knowledge I can't do a contains with that search.
>
>So, if anyone could help, here is what I need. First I'm not sure the the SQL-Select syntax for using the contains. Second, I would like the query to run as they type each letter in the text box, and I'm not sure if I should do this from the Interactive Change or the Keyboard method.
>
>Thanks for you help

First, I would do a search after each keystroke. This is only suitable when doing a seek where you are looking for a match at the beginning of the field.

Second, the SQL syntax is:

Select * from MyTable Where SomeField LIKE ?cString

before you run that code, set cString to the following:

cString = '%' + alltrim(ThisForm.txtBox.Value) + '%'

Depending on your needs you may need to use upper() or lower() on cString and on SomeField.
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform