using text box as query criteria

  • Thread starter Thread starter Tim J La Fazia
  • Start date Start date
T

Tim J La Fazia

I have a form with a subform. My main form has a text box wich is used in
the query expression of my subform.

In the KeyUp event of the text box I refresh the forms.

This works to filter my subform each time a new character is entered into
the text box.

My problem is every time a key is pressed the refresh selects the entire
contents of the text box.

each new letter you type replaces the last making it impossible to type an
entire word.

Is there and easy work around. Is there a way to mimic the end key behavior
in code?


TIA,

Tim
 
I have a form with a subform. My main form has a text box wich is used in
the query expression of my subform.

In the KeyUp event of the text box I refresh the forms.

This works to filter my subform each time a new character is entered into
the text box.

My problem is every time a key is pressed the refresh selects the entire
contents of the text box.

each new letter you type replaces the last making it impossible to type an
entire word.

Is there and easy work around. Is there a way to mimic the end key behavior
in code?

I suspect that the textbox's Change event will be more forgiving.

John W. Vinson [MVP]
 
The change event works in the same way.

It is the refresh command that causes the problem.

On refresh acts like focus of the text box is lost and then the text box is
re-entered. The result is the entire text is selected. So as you type you
only have one letter in the text box @ any given time. Each letter you type
replaces the last.

I need a work around. A way to move the cursor to the end of the text box
in code would work great.
 
A way to move the cursor to the end of the text box
in code would work great.

Me.controlname.SelStart = Len(Me.controlname)

or maybe that +1, I don't recall...

John W. Vinson [MVP]
 
That works great except you use a spaces.


John W. Vinson said:
Me.controlname.SelStart = Len(Me.controlname)

or maybe that +1, I don't recall...

John W. Vinson [MVP]
 
Back
Top