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

Bill Benson bensonforums at gmail.com
Thu Dec 25 16:50:25 CST 2014


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?





More information about the AccessD mailing list