Filter in the subform

  • Thread starter samotek via AccessMonster.com
  • Start date
S

samotek via AccessMonster.com

Can I apply a filter on the subform? With my main form, called frmoffers, I
choose the customer and then with the subform I choose the products.I want to
place a button on my main form to choose the supplier, for example:
strFilter = "products.supplierid = 1"
Me.Filter = strFilter
Me.FilterOn = True

But how can I refer to the subform and can i filter it?
 
J

Jeanette Cunningham

There are a couple of ways to do this.
The easiest way is to have the main form filter on the same field that is
the Link child fields and Link master fields.
This way, when the main form is filtered, the subform is automatically
filtered.

If you are not able to do that, then you can set the subform's filter in
code.

With Me.[SubformControlName]
.Filter = strFilter
.FilterOn = True
End With


Note: the subform control name may be different from the name of the form
*inside* the subform control.
You only need the square brackets if the name of the subform control has
spaces or special characters in it.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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