Button to filter subform data

  • Thread starter Thread starter Kurt
  • Start date Start date
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.
 
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
 
Back
Top