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
 
Top