|
-
May 18th, 2000, 07:36 AM
#1
Hi All,
I am stuck with trying to search a dbgrid as I type text in a textbox. I'd like the relevant record to be highlighted as I type the search string in the text box.
If someone could help, please, I'm really stuck with this.
-
May 20th, 2000, 06:54 AM
#2
Addicted Member
Code:
'just a shot
private sub textbox1_change()
'assume rsGridSource is the recordset of the grid
'and grdMyGrid as the grid
rsGridSource.Find = "column_name like " & textbox1 & "*"
grdMyGrid.Refresh 'or .Rebind
end sub
[Edited by pardede on 05-21-2000 at 01:55 AM]
[Edited by pardede on 05-21-2000 at 01:56 AM]
-
May 20th, 2000, 02:02 PM
#3
Thanks for that. However, the grid I have is a datagrid which is being fed by and ADO data control. I don't have too much experience with this so I'm not sure how to go about applying the code you've written. I can't use it the way it is as I'm not sure how to point it to the relevant recordset.
I am using an SQL statement within the ADO data control as the recordsource.
If you have any suggestions I would greatly appreciate it.
-
May 20th, 2000, 02:09 PM
#4
I've actually figured out how to apply your code, however it complains about the asterisk between the double quotes.
Also, it only works for the first character typed in. Any ideas on how it can keep on looking as you keep on typing?
Thanks.
-
May 20th, 2000, 02:12 PM
#5
You'll probably think I'm a fruit loop. This code actually does what I want it to do, without that asterisk though. I don't know how I didn't notice it before.
Thanks very much. It works great!!
-
May 21st, 2000, 01:15 PM
#6
Addicted Member
Hi,
There's a little flaw in my code, there should be single quotes sorrounding the text being sought in the sql so it should have read:
Code:
rsGridSource.Find = "column_name like '" & textbox1 & "*'"
-
May 21st, 2000, 01:29 PM
#7
Thanks again. I notice it only works with text but not numbers. Works great though. Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|