FIltering Subform based on User Entry

J

Joe Williams

I have a main form with a subform listing all of our employee names. How can
I put a text box on the main form where the user will begin typing in a name
and the subform will requery itself and show only those records that match
what was entered?

Thanks

Joe
 
N

Nikos Yannacopoulos

Joe,

Use the following criterion in the query being the subform's recordsource:

Like Forms![MyForm]![txtName] & "*"

so it filters on the control entry in the form (substitute with the actual
names).

Then, put this line of code behind the textbox's After Update or On Change
event:

Me.SubFormName.Requery

(substitute with the actual subform name).

HTH,
Nikos
 

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