ajetrumpet,
Thanks for the reply. The code worked fine when it looked like this
Code:
Private Sub Search_Change()
Dim vSearchString As String
vSearchString = search.Text
Search2.Value = vSearchString
DoCmd.Requery
Me.search.SetFocus
Me.search.SelStart = Len(Nz(Me.search, ""))
End Sub
What would happen in that case was the user would begin typing something into the box and after each letter was entered the requery would execute fine and the cursor would end up at the end of what was currently typed into the field. Now I have a few subforms on a dashboard type form now and I don't want to requery everything because it causes it to be slow. I only want the specific subform that the quick search box is meant to search within to requery. Hence my reasoning for changing the code to the following.
Code:
Private Sub Search_Change()
Dim vSearchString As String
Dim ctlCombo As Control
vSearchString = search.Text
Search2.Value = vSearchString
Set ctlQuery = Me.hsfProperties
ctlQuery.Requery
Me.search.SetFocus
Me.search.SelStart = Len(Nz(Me.search, ""))
End Sub
Everything works fine EXCEPT the fact that the cursor is always placed after the first letter in the text box, after the user enters another letter. What I don't understand is why the first code works perfectly but the second doesn't.