Filtering Subform based on user entry

J

Joe Williams

I have an unbound main form with a subform on it that shows client names. On
the main form I have a textbox called txtName.

What I would like to have happen is for the subform to show all records
initially when opened, then as the user types in a name, the subform will
update as they type in each letter to narrow down the list in the subform.

I have set up the record source for the subform to include LIKE
forms!frmMain!txtName & "*" for the appropriate name field in the query.

Then, on the txtName field, I put me.subform.requery in various events to
see if I can get it to do what I want.

The problem I am having is that it dos not appear to be requerying the
subform as the user types each letter into the text box. For instance, I can
type D to bring up client names starting with D. However, If I erase D and
put W, the subform will not update until I make the control lose focus, then
come back to it and press the backspace. Only then will the subform requery.

I have tried the event in the AfterUpdate, KeyPress, and KeyDown events.

What am I doing wrong and where can I put the event so that it requries the
subform every time the user enters (or erases) characters in the textbox?

Thanks

joe
 

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