G
Guest
Hi all..I have created a Search Form where end-user will enter client Name
and depending on what they enter, I have a list box below that will show the
matching results. What I want to do is basically when user enters lets say
mi, the search should display any client name that starts with MI, if the
user keeps entering more characters like MIKE then the search result should
display that. I wrote the code below and works fine except a user has to hit
enter key to display the result. I don't want it to do that way. Similarly, I
also want when end-user erases any character using back space, it should
requery and display the matching result.
Private Sub txtClientName_AfterUpdate()
Dim txtSearchString
Dim strSQL
txtSearchString = Me.txtClientName.Value
strSQL = "select tblClient_ClientName FROM tblClient WHERE
((tblClient.tblClient_ClientName) Like '" & txtSearchString & "*') "
Me.lstResult.RowSource = strSQL
Me.lstResult.Requery
End Sub
PS. I have used every event like lost focus, on change, after update and
nothing seems to work.
and depending on what they enter, I have a list box below that will show the
matching results. What I want to do is basically when user enters lets say
mi, the search should display any client name that starts with MI, if the
user keeps entering more characters like MIKE then the search result should
display that. I wrote the code below and works fine except a user has to hit
enter key to display the result. I don't want it to do that way. Similarly, I
also want when end-user erases any character using back space, it should
requery and display the matching result.
Private Sub txtClientName_AfterUpdate()
Dim txtSearchString
Dim strSQL
txtSearchString = Me.txtClientName.Value
strSQL = "select tblClient_ClientName FROM tblClient WHERE
((tblClient.tblClient_ClientName) Like '" & txtSearchString & "*') "
Me.lstResult.RowSource = strSQL
Me.lstResult.Requery
End Sub
PS. I have used every event like lost focus, on change, after update and
nothing seems to work.