Hey,
i have a search form that uses a very simple query with a WHERE clause to filter values in a list box for the purpose of searching through records.
I have a simple filter system setup so you can enter a search value
Put into the " WHERE x LIKE 'Value here'"
I am looking for a way to make the system Refresh the list everytime a new character is pressed in the text box.
EG im searching for last name doe
i hit D and it eliminates all people who do not have a D as the first character
Then i hit o and it eliminated all people who do not have an o
as i have it you have to type the whole string first (after update).
But i have been having some issues using the keypress events as they don't seem to work quite how i would have imagined them to work.
any suggestions on how i can go about implementing this ?
at the moment i have this Sub to do the updating
[vba]Private Sub UpdateCriteria()
Dim SqlText As String, temp As String
If IsNull(Me.FilterText) Or Me.FilterText = "" Then
temp = "*"
Else
temp = Me.FilterText
End If
SqlText = "SELECT [MedicalID#], LastName, Firstname, Birthdate FROM tblPatient"
Select Case Me.SearchOption
Case 1
SqlText = SqlText & " WHERE [MedicalID#] LIKE '*" & temp & "*'"
Case 2
SqlText = SqlText & " WHERE Firstname LIKE '*" & temp & "*'"
Case 3
SqlText = SqlText & " WHERE Lastname LIKE '*" & temp & "*'"
End Select
Me.PatList.RowSource = SqlText
Me.PatList.Requery
End Sub[/vba]