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
 
Top