Hi Jon,
I don't think Bruce's method will do what he thinks it will ... but I could
be wrong ... go ahead and try.
I think it will indeed "select" the first row that it fits the criteria, but
I doubt that it will scroll to it? AFAIK, there is no way to automatically
scroll to the desired row.
Now I'm thinking that you may be able to limit the number of rows that do
get displayed in the list, and eliminate (or at least reduce) the need for
scrolling .
This could be done by building an SQL string in code, and then using that
SQL as the Row Source for the listbox.
Try this, and see if it suits your needs...
(You will have to edit Table, Field, and Control Names ... )
*******************************************
Private Sub cmdRequeryListbox_Click()
Dim strFilter
Dim MySQL As String
Dim whr As String
strFilter = Me.txtFilter
MySQL = ""
MySQL = MySQL & "SELECT YourTableName.YourFieldName FROM YourTableName "
whr = ""
If Len(strFilter) > 0 Then 'If the user has typed something to narrow
the search
whr = whr & "WHERE (((YourTableName.YourFieldName ) Like "
'There are two ways to go here ... "Contains" OR "Begins With"
'eg "*pat*" would give you "Patrick Fitzsimons" AND "Simon Fitzatrick"
' or "pat*" would return "Patrick Fitzsimons" only
'--- this example is for "Contains ---"
whr = whr & " '*' "
whr = whr & " & "
whr = whr & Chr$(34) & strFilter & Chr$(34)
whr = whr & " & "
whr = whr & " '*' "
whr = whr & "))"
MySQL = MySQL & whr 'Insert the WHERE into the SQL string
End If
MySQL = MySQL & ";"
'Debug.Print MySQL
Me.lstFiltered.RowSource = MySQL
End Sub
*******************************************
HTH,
Don
Jonathan LaRosa <jl*****@alumni.brown.edu> wrote in message
news:e6**************************@posting.google.c om...
Not trying to be a "smart-ass" ... but isn't that what a combo-box does
.... without the need for a seperate textbox...?
Let me qualify that ... a combobox with it's AutoExpand Property set to
True (which is the default) will do that..
yes, this is what a combo box does. except there is a requirement
that i did not mention that forces the use of a list box - the ability
to select multiple values. which means the combo box idea is out.
thanks,
jon