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

datagrid jump to

Status
Not open for further replies.

TheCandyman

Technical User
Sep 9, 2002
761
US
I have a datagrid displaying records from a Access DB. I wanted to make a small box where people could type things and it would jump to that. Like so...

user types: r

datagrid jumps down to the records that start with 'r'

I know it's possible, but not sure how to do it in VB. Was thinking of doing a quick look through the RS until the text typed in matches the Left(string1, 1) value of the RS. Thoughts? Ideas with code?
 
Hey,

Should work. What you will need to do is something like this:

rs.Movefirst ''' Seem to get into trouble sometimes if I don't use this
rs.Find(Left$(string1,len(trim$(string1))), 0, adSearchForward, adBookmarkFirst)

Then depending on how the grid is setup bound or unbound, sorted or unsorted you may have to set the row and toprow of your grid.

Your code should go in one of the Key events for the textbox.

good luck
KCI
 
it is sorted by the name, so that shouldn't be a problem. Im not sure what you mean by 'bound or unbound' and how do i set the row and toprow of the grid?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top