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

Going To A Specific Record in a List Box

Status
Not open for further replies.

monrosal

Programmer
Aug 22, 2000
42
0
0
US
Does anybody know how I can go to a specific record within a list box? Ultimately, I would like to have a text field and a search button on a form. When a user searches for a certain record and presses submit, the list box will go to that specific record, but still displaying all the records in the list box. Basically, I just want to "go" to a certain spot in a list box. How can I do this?

Ramon
 
Loop through the list box, if you find match then select that record. Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need!
 
On the afterupdate of the listbox or the on click of your button you could try something like this. Remember if it is done via a button you will need to store the strFilter on the onclick event of the list box so at the very top of the module add private strfilter as string then onclick event of the list box add strfilter=me("MyListBox") I think it will give you a start? Make sure the listbox *which I assume is unbound* and the whateverrecord have a match on the form so you can find the record.

This will at least give you an idea.

Dim rs As Object
Dim strFilter As String

strFilter = Me("MyListBox")

Set rs = Me.Recordset.Clone
'* we need to handle strange characters in the list box
'* so we need to handle them with double quotes.
rs.FindFirst "[whateverrecord] = """ & strFilter & """"

Me.Bookmark = rs.Bookmark
Life's a journey enjoy the ride...

jazzz
 
Thank you both for your suggestions. I really appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top