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

Arthur Fuller fuller.artful at gmail.com
Mon Dec 29 18:10:07 CST 2014


Tempvars are a convenient solution, but their big problem is that they are
only respected in the most recent versions of Access. And that is one
serious problem. The most recent alternatives are two other approaches:
static functions and classes. See my previous posts on static funcs and
JC's posts on classes, from which I have learned a ton. Both, in my view,
present useful solutions, and I have incorporated both within a single
project.

IMO, TempVars was a lame attempt to solve a universal problem. JWC and I
have both provided far better solutions.

On Mon, Dec 29, 2014 at 4:42 PM, Bill Benson <bensonforums at gmail.com> wrote:

> Thank you and I probably don't follow all that Tempvar stuff, however I
> don't sense that it meets my needs in this situation...
>
> For one thing, the combos are for the purpose of setting (or selecting)
> companyids for either existing or new orders, and it is not my intent to
> restrict them.
>
> My solution is working just fine, this whole thread was not for any other
> purpose to see if a filter was dynamic, and I have learned that it is not.
> On Dec 29, 2014 4:25 PM, "Charlotte Foust" <charlotte.foust at gmail.com>
> wrote:
>
> > Another way might be to modify the source queries for the combo boxes to
> > use a TempVar to filter the returned records.  The same TempVar can be
> used
> > for all 3 comboboxes, and you can create a a loop in the OnCurrent event
> to
> > test for a change in the TempVar value and then requery the combos.
> >
> > Charlotte
> >
> > On Sat, Dec 27, 2014 at 6:18 PM, Bill Benson <bensonforums at gmail.com>
> > wrote:
> >
> > > Hi Gustav and happy holiday week.
> > >
> > > I can't set the filter on form load because the items being filtered on
> > (on
> > > demand) are company id's in 3 different combo boxes. I just have to
> reset
> > > the filter in the afterupdate event for the combos, testing first to
> make
> > > sure the filter toggle is true at such time... and also to reset the
> > filter
> > > when a toggle click results in its changing state from false to true. I
> > had
> > > just (through inexperience with how to assign things to a filter in
> > code),
> > > sillily thought that I could "set and forget" -- i.e., tie to the
> combos
> > > once and for all. Like making a controlsource for a filter. Apparently
> > the
> > > filter property does not behave the way I was thinking it ought but it
> is
> > > no big deal. Living in a dream world where computers do what I want --
> > not
> > > the real world.
> > >
> > >
> > > On Sat, Dec 27, 2014 at 5:01 PM, Gustav Brock <gustav at cactus.dk>
> wrote:
> > >
> > > > Hi Bill
> > > >
> > > > If this is your problem, just set (or remove) filters by code when
> you
> > > > open the form.
> > > >
> > > > Also, I think all of us have to look up items regularly.
> > > >
> > > > /gustav
> > > >
> > > > ________________________________________
> > > > Fra: accessd-bounces at databaseadvisors.com <
> > > > accessd-bounces at databaseadvisors.com> på vegne af Bill Benson <
> > > > bensonforums at gmail.com>
> > > > Sendt: 27. december 2014 21:59
> > > > Til: Access Developers discussion and problem solving
> > > > Emne: Re: [AccessD] trying to filter a form on a control's value
> > > >
> > > > I have used filters sometimes in the past, and the way they interact
> > with
> > > > filteron, their picky syntax, the inability to set and forget them,
> > > because
> > > > they are not dynamic like a controlsource; they are easy to be made
> > > > obsolete.
> > > >
> > > > And I usually can't recall whether recordsetclone is or is not
> affected
> > > by
> > > > the filter when filteron  is true, I have to keep looking that up!
> > > >
> > > > I give them the well earned label of "tricky"; I also wish there
> were a
> > > > filters collection for increments and decremental filters.
> > > > On Dec 27, 2014 12:03 PM, "Gustav Brock" <gustav at cactus.dk> wrote:
> > > >
> > > > > Hi Bill
> > > > >
> > > > > No, filters are not very tricky. But the filter can only be changed
> > if
> > > > > something tells it so.
> > > > > So either you will have to use the AfterUpdate event of the other
> > form
> > > to
> > > > > reapply the filter, or you can use the OnActivate event of the form
> > to
> > > > > check if the value to filter for has changed on the other form.
> > > > >
> > > > > /gustav
> > > > >
> > > > > ________________________________________
> > > > > Fra: accessd-bounces at databaseadvisors.com <
> > > > > accessd-bounces at databaseadvisors.com> på vegne af Mark Simms <
> > > > > marksimms at verizon.net>
> > > > > Sendt: 27. december 2014 17:22
> > > > > Til: 'Access Developers discussion and problem solving'
> > > > > Emne: Re: [AccessD] trying to filter a form on a control's value
> > > > >
> > > > > Yes, that toggle is required. Filters are very tricky.
> > > > >
> > > > > >
> > > > > > 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
> > > > --
> > > > 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
>



-- 
Arthur


More information about the AccessD mailing list