November 10th, 2004, 09:09 PM
TADOQUERY "Search" not "Filter"
Hey all I have an Access database I wish to "Search" for data in, I am using the TadoQuery Control. I am also doing SQL commands with this component ( Main Reason I am using it ) I have only found ways to Filter Data but not search through it without either filtering or searching by Scanning ( Which is VERY slow ) I need speed! I have database RecordSets that exceed 29k Records. I am using a Jet 4.0 connection. any Ideas?
November 10th, 2004, 11:13 PM
Have you tried changing the SQL property of the TADOQuery at runtime.
Of course, it would help if tablename has an index for col4 in the above example.
with Query1 do
SQL.Add('SELECT col1, col2, col3');
if (sLike <> '') then
SQL.Add('WHERE col4 LIKE ''' + sLike + '%'' ');
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
November 10th, 2004, 11:43 PM
Thank you for your reply, the code you supplied was for Filtering the data not searching. I say Search meaning it Keeps the Whole Record on the Screen and sets the Active Record (Row) to the one found in the Search function.
P.S. I already have the code for my SQL commands finished, which filters the data Perfectly
Originally Posted by Scorpions4ever
November 11th, 2004, 02:11 AM
After doing some research I found limitations with the TADOQuery component as of which pertain mostly to Searching. And since it does not look like I am going to be able to do what I need with any decently "Short" code I am going to modify my Application and use the Filter property along Side the Regular SQL commands. In testing works much better then I would have hoped and will function for what I need. I do appreciate your help.