Subject Re: multiple filter problem
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Fri, 31 Jan 2025 14:28:12 -0800
Newsgroups dbase.getting-started

On 1/31/2025 1:29 PM, Charlie wrote:
> I am trying to filter on two different fields that are character, but get an error 'expecting logical'.  I've tried macros and other things
>
> How can I get this to work?
>
> function COMBOBOX1_onChange()
>        ct = form.category1.rowset
>        cl = form.collection1.rowset
>                 fltr = trim(ct.fields["cat"].value)
>                 fltr2 = trim(form.combobox1.value)
>                 if trim(form.combobox1.value) = "ALL ERAS"
>                     // trim(form.combobox1.value)
>                 else
>                    msgbox( ""+fltr+" "+fltr2)  //filters show correct data in this msgbox.
>                    //fltr2 = ""
>                  cl.filter = [era ='] + fltr2 + ['] and [category ='] + fltr + [']//  line that gets the error
>                 endif
>                 form.collection1.requery()
>        return

I think Heinz is correct.

cl.filter = [era ='] + fltr2 + ['] and [category ='] + fltr + [']//
line that gets the error

The word "and" has to be in the string that is built. You have it
outside of it.

cl.filter = [era ='] + fltr2 + [' and category ='] + fltr + [']//  line
that gets the error

See the difference?

Ken

--

*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
dBASE Web Tutorial: http://www.goldenstag.net/dbase/WebTutorial/00_Menu.htm
dBASE DOS to Windows Tutorial:
http://www.goldenstag.net/dbase/DtoWTutorial/00_Menu.htm