Requerying Listboxes (1 Viewer)

ca9mbu

New member
Local time
Today, 00:30
Joined
Feb 9, 2000
Messages
5
I'm trying to filter the records displayed in a list box based on what a user types in a textbox next to it. Although I can get it to work using the AfterUpdate() method of the text box I'd like it to requery after each letter is typed in the text box. I've tried putting the same code in KeyDown(), KeyPress & KeyUp, but it doesn't work (apparently the text box still contains a null value at each of these stages). Any ideas?

Matt
 

ca9mbu

New member
Local time
Today, 00:30
Joined
Feb 9, 2000
Messages
5
I've tried OnChange() as well (sorry for not including that in my original post). In all of those events for some reason the textbox contains a nullvalue (even though it has a character is typed in it)...it's as if the event is generated just before the character is displayed on screen - very frustrating.

Matt Burgess

[This message has been edited by ca9mbu (edited 02-27-2001).]
 

Alexandre

Registered User.
Local time
Today, 06:30
Joined
Feb 22, 2001
Messages
794
It is very tricky to try to get a value being comitted using OnChange, since a that stage it is nor validated yet.

I would advice to call from the afterTab event of the textbox a macro actualizing the combox. This should perform the requery once a new value is entered in the textbox.

Then, you will still face a problem if you which the user to be able to switch to a new record in the same form: the two controls won t stay synchronized. You would then need to add a .refresh method applied to the form or subform containing the synchronized controls, in the On current envent of the main form.

Hope this helps.
 

Alexandre

Registered User.
Local time
Today, 06:30
Joined
Feb 22, 2001
Messages
794
Sorry, I read a bit rapidly. If you really want to grab uncommited values in a control, you have to use the OnChqnge event and the .Text property (me!tbxControl.Text)
 

Users who are viewing this thread

Top Bottom