STOP REMOVING TRAILING SPACES !!!!!!

G

Guest

Hi all !

I have a list box that displays results of a filter based on information
that is entered into a text box. Everything works fine, but the list box only
requeries once the cursor is tabbed out of the text box. It seems as if the
information in the text box is not made available to the list box filter
until the editing is finished. This is a pain because the user will not know
how many characters to put into the text box before the selection remaining
in the list box is managable.

The closest I've come to a solution is to set up a KeyUp event that sets the
focus to another field before requerying the listbox, and then setting the
focus back to the original text box (to prevent the entire text being
highlighted when re-entering the text box click the tools>options>keyboard
(tab)>behaviour entering field=go to end of field)

The only problem with this is when entering a two word search string into
the text box. When the focus is removed from the text box, access thinks that
the editing is over and automatically removes the trailing space. The user
then types the second word and the listbox filter fails because there is no
space between the two words.

Any solution to this would be much appreciated !!!

Cynic
 
G

Guest

Try something similar to this

If your ListBox is called lstList and your text box is called txtFilter then
change your SELECT statement in your list box to this

SELECT [TableName].[FieldName] FROM [TableName] WHERE [FieldName] LIKE
txtFilter.Text & "*";

In the On Change event of the txtFilter box put this

lstList.Requery
 
G

Guest

Sussed it thanks

I've just learnt how to use keycodes!

Dennis said:
Try something similar to this

If your ListBox is called lstList and your text box is called txtFilter then
change your SELECT statement in your list box to this

SELECT [TableName].[FieldName] FROM [TableName] WHERE [FieldName] LIKE
txtFilter.Text & "*";

In the On Change event of the txtFilter box put this

lstList.Requery


cynic said:
Hi all !

I have a list box that displays results of a filter based on information
that is entered into a text box. Everything works fine, but the list box only
requeries once the cursor is tabbed out of the text box. It seems as if the
information in the text box is not made available to the list box filter
until the editing is finished. This is a pain because the user will not know
how many characters to put into the text box before the selection remaining
in the list box is managable.

The closest I've come to a solution is to set up a KeyUp event that sets the
focus to another field before requerying the listbox, and then setting the
focus back to the original text box (to prevent the entire text being
highlighted when re-entering the text box click the tools>options>keyboard
(tab)>behaviour entering field=go to end of field)

The only problem with this is when entering a two word search string into
the text box. When the focus is removed from the text box, access thinks that
the editing is over and automatically removes the trailing space. The user
then types the second word and the listbox filter fails because there is no
space between the two words.

Any solution to this would be much appreciated !!!

Cynic
 

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

Top