From: samotek via AccessMonster.com on
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?

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201004/1

From: Jeanette Cunningham on
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

"samotek via AccessMonster.com" <u15330(a)uwe> wrote in message
news:a736653f72fa6(a)uwe...
> 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?
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201004/1
>