[AccessD] trying to filter a form on a control's value

Charlotte Foust charlotte.foust at gmail.com
Fri Dec 26 09:05:07 CST 2014


Are you setting the Filter On property too?  I seem to recall needing to
set filter on to False, setting the filter, and then setting filter on to
True.

Charlotte

On Thu, Dec 25, 2014 at 2:50 PM, Bill Benson <bensonforums at gmail.com> wrote:

> I want to filter a form, when a toggle is depressed based on a control
> value on my form. When that control changes, I want the filter to be
> applied. I have tried without success to set the filter a myriad of
> different ways, and whatever I try, the filter is ineffective (returns no
> records) when I use any of these attempts.
>
> I have tried:
>          Filter = "FKCompanyID= [Forms]!frmOrders![txtWholesalerID]"
>          Filter = "FKCompanyID= [Forms]!frmOrders!txtWholesalerID"
>          Filter = "FKCompanyID=
> [Forms]!frmOrders!Controls("txtWholesalerID")
>          Filter = "FKCompanyID= [Forms]!frmOrders!cboWholesaler.Column(0)
>          Filter = "FKWholesalerID=
> Forms(""frmOrders"").Controls(""cboWholesaler"").Column(0)"
>          Filter = "FKWholesalerID=
> Forms(""frmOrders"").Controls(""txtWholesalerID"")"
>
> Finally, getting desperate, I tried a UDF GetWholesalerID() which returned
> the value of one of the controls above, and that would work in the filter.
>
>          Filter = "FKWholesalerID=" & GetWholesaler()
>
> The annoyance though, is that I need to call this in the AfterUpdate event
> of the control that drives it, since the function is not volatile - as
> reference to a control would be on its own.
>
> Is there any form of compliant syntax which will allow me to establish a
> direct dependence between the filter and the referenced control?
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


More information about the AccessD mailing list