filter with OR

Discussion in 'Questions (Windows Mobile)' started by derez, Jul 20, 2009.

  1. derez

    derez Expert Licensed User

    The help for Table control says this:

    You can add conditions using AND, OR:
    Table1.Filter ("colApples = 8 AND colFirstName = 'John'")

    I'm using OR to filter the contents of four columns which may contain a keywords, in any of the columns, and I want to get all the lines which contain that keyword.

    The keyword is defined in a string "st".

    Code:
    If St <> "" Then rcptdb.Filter("Ing1='" & st & "'" OR "Ing2='" & st & "'" OR "Ing3='" & st & "'" OR "Ing4='" & st & "'")



    when compiling for desktop or device I get the attached error , running in IDE goes fine without errors.
    If I cut the filter sentence to eliminate the other options - it compiles:
    rcptdb.Filter("Ing1='" & st & "'" )

    I'll appreciate a hint ...:BangHead:
    Thanks

    Edit: Found it myself , it should be like this, where the OR is part of the condition string:

    If St <> "" Then rcptdb.Filter("Ing1='" & st & "' OR Ing2='" & st & "' OR Ing3='" & st & "' OR Ing4='" & st & "'")
     
    Last edited: Jul 20, 2009
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice