Prevent Full String Selection after Change Event on Control


Barry Tank

I have created a form for filtering a query (txtCustomerName field) by typing
in value. The form has a single text box (unbound or bound to a field hasn't
helped). There is a subform based on a query which returns all records
sorted by customer name. When characters are typed in the text box, the
query is filtered using the following (like "*"&
[Forms]![frmCustomerLookup]![txtLookupName] & "*"). I trap the Change Event
on the control txtCustomerName, refreshing the subform with Me.Refresh after
each change event (It filters exaxtly the way I want it to). Here is my
problem: After each character is entered, all the text is selected, and the
next keystroke replaces all of the text. The user will have to use the right
arrow key (assuming the behavior is set to allow this) or click in the field
after the existing text every time a new character is typed. Is there a way
to enter a Right Arrow Key command after the refresh. Issuing the Refresh
command on the main form is the only way I have successfully filtered the
records after each keystroke, but maybe there is a better way. Additionally,
"spaces" entered get wiped out immediately, which I could live with, but
would like to use them in the filter string as well.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question