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

Bill Benson bensonforums at gmail.com
Fri Dec 26 09:38:25 CST 2014


That's what I thought Jim. As I wrote, since this filter doesn't reapply
itself the way a control source would, I gave up on filter.

To better explain, what I really wanted was a filter to be formulaic. But
it never is, it can be set US ING a formula,  but it is always going to be
a fixed string.

By contrast, a controlsource is also a string but Access recomputes what it
should display - and can be set to depend on a function or another control.
A filter apparently doesn't do those kinds of things, I was just using
wishful thinking.
On Dec 26, 2014 9:35 AM, "Jim Dettman" <jimdettman at verizon.net> wrote:

>
>
> I guess I am missing the point of the question and not understanding what
> you are trying to do.
>
> You've got to set the filter.  It can be a generic control reference in the
> filter string, but your still going to need to do something in the
> AfterUpdate of a control to force the form to apply the filter even so.
>
> Jim.
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson
> Sent: Thursday, December 25, 2014 06:22 PM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] trying to filter a form on a control's value
>
> But that is not any better than using the UDF Jim (well, a tiny bit less
> overhead and a bit more direct). However, when the control changes there
> will be no change to what the filter evaluates to when the control changes
> value. And that is my goal.
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim Dettman
> Sent: Thursday, December 25, 2014 6:18 PM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] trying to filter a form on a control's value
>
>
>  You were close....correct syntax is:
>
>  Me.Filter = "[FKCompanyID] = " & [Forms]!frmOrders![txtWholesalerID]
>
>   if this is frmOrders, then that can be shortened to:
>
>  Me.Filter = "[FKCompanyID] = " & Me.[txtWholesalerID]
>
>  This assumes a numeric.  If ID is text, then:
>
>  Me.Filter = "[FKCompanyID] = " & chr$(34) &
> [Forms]!frmOrders![txtWholesalerID] & chr$(34)
>
> Jim.
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson
> Sent: Thursday, December 25, 2014 05:50 PM
> To: 'Access Developers discussion and problem solving'
> Subject: [AccessD] trying to filter a form on a control's value
>
> 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
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> 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