list box trouble

AngryPanda

New member
Local time
Tomorrow, 03:50
Joined
Apr 26, 2007
Messages
7
For my database I have a search option which has a;
list box - that has the list of destinations
text box - to type in a destination which will search the list box and highlight/eliminate all entries that do not match
reset button - for the text box

the list box works and so does the reset button but for some reason when you type a destination in the text box it doesn't not search through the list and eliminate the destinations that do not match.
can anyone please help?
 
What code do you have that you expect to achieve that functionality?
 
Private Sub TxtSearch_Change()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim vSearchString As String
Dim Iref As Long

vSearchString = Me.txtSearch.Text

Set db = CurrentDb()
Set rst = Me.List2.Recordset.Clone
rst.FindFirst "Destination Like '" & vSearchString & "*'"

If rst.NoMatch Then
Me.List2 = ""
Else
Iref = rst!DestinationID
Me.List2 = Iref
End If

End Sub
 
Try this after setting the variable:

Me.List2.RowSource = "SELECT Whatever FROM TableName WHERE Destination Like '" & vSearchString & "*'"

Changing the field(s) and table as appropriate.
 

Users who are viewing this thread

Back
Top Bottom