Subject Re: filter switch problem
From charlie <tm@tc.com>
Date Wed, 16 Dec 2020 07:52:10 -0500
Newsgroups dbase.getting-started

Thanks Mervyn!

Mervyn Bick Wrote:

> On 2020/12/16 10:49, Charlie wrote:
> > The following works fine except after you first open the form you have to push the button twice.  First attempt does nothing.  From then on it does fine.  Thanks!
> >
> >     function PUSHBUTTON5_onClick()
> >        if not this.text = ' Hide OK '
> >                    form.master1.rowset.filter = "audit = 1"
> >           this.text = ' Hide OK '
> >        else
> >                    form.master1.rowset.filter = "audit = 1 and inv_ok # true"
> >                         this.text = ' Show OK '
> >        endif
> >                 
> >
>
> If your form already has a form_onOpen event handler, try placing the
> appropriate line in the form's form_onOpen event handler to set the
> filter when the form opens.  Alternatively create a PUSHBUTTON5_onOpen
> event handler and use that.
>
> The object of the exercise is to have the appropriate index set when the
> form opens as if the pushbutton had been clicked to set the text and the
> index.
>
> If the pushbutton opens with it's text property set to ' Hide OK' then
> place   form.master1.rowset.filter = "audit = 1"   in the event handler.
>
> If the pushbutton opens with it's text property set to ' Show OK' then
> place   form.master1.rowset.filter = "audit = 1 and inv_ok # true"   in
> the event handler.
>
>
> Mervyn.