Button to filter subform data

K

Kurt

I have a subform (in datasheet view) linked to a mainform.

I would like to create a command button on the main form
that, when pressed, filters the subform data to show only
records with a Yes/True in a certain Y/N field.

What I use for the OnClick code?

Thanks.
 
N

Naresh Nichani MVP

Hi:

Try this ' assume Subform1 is the subform name

With Me.Subform1.Form
.Filter = "[ToCheck] =True" 'ToCheck is Y/N field name
.FilterOn = True
End With

Regards,

Naresh Nichani
Microsoft Access MVP
 

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