Tricky to explain but spent ages on this & should be simple but can't work out.
Have a text box I use for searching.
but after pressing enter to search I want it to highlight the existing text ready to type over the top of it without using delete button.
Basically type e.g. JONES
if result are not what I want just type SMITH (without deleting back over)
Private Sub SearchMain_AfterUpdate()
DoCmd.ApplyFilter "EmailPasteSearch"
Me.SearchMain.SelStart = 0
Me.SearchMain.SelLength = Len(Nz(Me!SearchMain, ""))
' Me.DummyField.SetFocus ' does not seem to move auto, perhaps the applyfilter refreshes & stays put
End Sub
This works, filter applied & my list is filtered.
However the cursor is at the start of the text & not highlighted.
I have the same code in got focus.
I notice running applyfilter it does not auto tab/move to the next field
I can't even setfocus to a dummy field and setfocus back, errors, can't move to ... tried in all events. gotfocus,enter etc. not sure why error'ing. Had a DoEvents & tried so many things.
I suspect the apply filter is refreshing everything but I still can't see why I can't highlight the textbox.
I have this working elsewhere but on some quite complicated code that does a variety of things and I wrote this a long time ago & trying to trace is tricky.
Any ideas
thanks I/A
Have a text box I use for searching.
but after pressing enter to search I want it to highlight the existing text ready to type over the top of it without using delete button.
Basically type e.g. JONES
if result are not what I want just type SMITH (without deleting back over)
Private Sub SearchMain_AfterUpdate()
DoCmd.ApplyFilter "EmailPasteSearch"
Me.SearchMain.SelStart = 0
Me.SearchMain.SelLength = Len(Nz(Me!SearchMain, ""))
' Me.DummyField.SetFocus ' does not seem to move auto, perhaps the applyfilter refreshes & stays put
End Sub
This works, filter applied & my list is filtered.
However the cursor is at the start of the text & not highlighted.
I have the same code in got focus.
I notice running applyfilter it does not auto tab/move to the next field
I can't even setfocus to a dummy field and setfocus back, errors, can't move to ... tried in all events. gotfocus,enter etc. not sure why error'ing. Had a DoEvents & tried so many things.
I suspect the apply filter is refreshing everything but I still can't see why I can't highlight the textbox.
I have this working elsewhere but on some quite complicated code that does a variety of things and I wrote this a long time ago & trying to trace is tricky.
Any ideas
thanks I/A