
Signature
Where are we going and why am I in this HAND BASKET??
>Hello Everyone:
>The following code works very well except that the user has to keep clicking the
[quoted text clipped - 3 lines]
>recall that there is a simple way to make the cursor position itself at the end
>of the string, but I'll be damned if I can find it in the MS help at this point!
Do you mean you want to set the Cursor location at the end of whatever is in txtFilter? If so, you can do this:
Me.txtFilter.SetFocus
Me.txtFilter.SelStart = Len(nz(Me.txtFilter, ""))
>Private Sub txtFilter_Change()
>Dim strSQL As String
[quoted text clipped - 20 lines]
>Any help will be greatly appreciated!
>-plh
Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
plh - 31 May 2007 18:13 GMT
[snip]
>Do you mean you want to set the Cursor location at the end of whatever is in
>txtFilter? If so, you can do this:
>
>Me.txtFilter.SetFocus
>Me.txtFilter.SelStart = Len(nz(Me.txtFilter, ""))
[snip]
>Scott McDaniel
>scott@takemeout_infotrakker.com
>www.infotrakker.com
Thank you, Scott, it did reset the position but now I have another problem:
Here is the new code:
Private Sub txtFilter_Change()
Dim strSQL As String
Debug.Print Me.txtFilter.Value
strSQL = "SELECT * FROM tblCustOrds WHERE COP LIKE '" & Me.txtFilter.Value &
"*'"
With Me
.Refresh
.RecordSource = strSQL
.txtFilter.SetFocus
On Error Resume Next
.txtFilter.SelStart = Len(.txtFilter)
End With
End Sub
strSQL does not contain the most recent entry into the text box, for example, if
the user types "1", nothing happens, because at that point strSQL contains
"SELECT * FROM tblCustOrds WHERE COP LIKE '*'". Then if the user types "2" so
that the text box says "12", strSQL contains "SELECT * FROM tblCustOrds WHERE
COP LIKE '1*'" so now it filters those records where the first digit is equal to
1. In other words, the filtering action always lags one step behind what the
user has entered into the box. Is there anything that will alleviate that
effect?
Thank You,
-plh

Signature
Where are we going and why am I in this HAND BASKET??