Table Filter with "and"

Discussion in 'Questions (Windows Mobile)' started by hardy, Jun 23, 2008.

  1. hardy

    hardy New Member Licensed User

    hi,


    i would like to make a Filter like that but it doesnt work, Whats wrong?


    Thank you

    Hatmut


    sr = "*" & Table1Textbox.Text & "*"
    sr1 = "*" & Textbox30.Text & "*"

    Table1.Filter("benennung LIKE '" & sr & "'" AND "benennung LIKE '" & sr1 & "'")
     
  2. Mr_Gee

    Mr_Gee Active Member Licensed User

    Do you have a textbox named "Table1Textbox"

    Also I usually start with 1 filter item, and if it works add the 2nd

    -= edit=-
    tried it and i don't think the TABLE allows this since you are searching in the same column at the same time while the example is using a different column
    as a workaround I would filter using one argument, copy that information to a temp table and search using the 2nd argument

    Unless Erel has a solution :)




    Code:
    Sub App_Start
       Form1.Show
          Table1.AddCol(cString,
    "benennung",80,False)
       i = 
    0
       
    Do Until i = 60 
       Table1.AddRow(
    "Test"&i)
       i = i + 
    1
       
    Loop      
    End Sub
    Sub Button1_Click
    'sr = "*" & Table1Textbox.Text & "*"
    'sr1 = "*" & Textbox30.Text & "*"
    'Table1.Filter("benennung LIKE '" & sr & "'" AND "benennung LIKE '" & sr1 & "'") 
    Table1.Filter("benennung LIKE 5" AND "benennung LIKE 9"
    End Sub
     
    Last edited: Jun 23, 2008
  3. jeterry

    jeterry Member Licensed User

    SQL Filter

    I tried this on a SQL database and it worked for me.

    select * from inventory where description like '%Milk%' and description like '%GOAT%'

    yielded one record with milk and goat in the description.

    also tried it with OR and had all of the records with milk in the description and one goat.

    To filter you must use the percent sign as shown

    Hope this is what you are looking for
     
  4. Mr_Gee

    Mr_Gee Active Member Licensed User

    To be honest I would also go for SQL in this case.
     
  5. specci48

    specci48 Well-Known Member Licensed User

    Hi all,

    the solution looks like this:
    Code:
    Table1.Filter("benennung LIKE '" & sr & "' AND benennung LIKE '" & sr1 & "'"
    The AND has to be within the "".


    specci48
     
  6. Mr_Gee

    Mr_Gee Active Member Licensed User

    I can't believe I missed that one :-(

    that did the trick, kudos to you
    :sign0188:
     
  7. specci48

    specci48 Well-Known Member Licensed User

    I had to look twice, too... ;)
     
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