Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Jul 2001
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ADO and filters (VB6)

    hello all

    I get the following error message
    error 3001: "Arguments are of the wrong type, are out of acceptable
    range, or are in conflict with one another"
    when I run the Visual Basic 6 ADO expression below

    rs_search.filter = "DrawingDescription NOT LIKE *flange*"

    The same expression works fine if I us "LIKE" only

    rs_search.filter = "DrawingDescription LIKE *flange*"

    Can someone please help me, I have read somewhere that i can use LIKE, AND, OR in this kind of expression but cannot use NOT LIKE, is there an equivalent way to express "not like" in my example, and why does it not accept it?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: ADO and filters (VB6)

    Since you are using a string comparison, the string value must be enclosed in quotes, for example

    <code>rs_search.Filter = "DrawingDescription NOT LIKE '*flange*'"</code>

    You should use the quotes for the LIKE case too:

    <code>rs_search.Filter = "DrawingDescription LIKE '*flange*'"</code>

    If * doesn't work, you may need to use %. I don't know where your data are.

  3. #3
    2 Star Lounger
    Join Date
    Jul 2001
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ADO and filters (VB6)

    Well, we tried this but it I think the problem is that we are trying to concatenate two strings together and the "not like" is giving us a problem. When we concatenate two "like" strings together separted by and AND though it is no problem. Microsoft has said that NOT LIKE is not allowed as a filter when using an ADO.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: ADO and filters (VB6)

    So why are you trying to use NOT LIKE if it isn't allowed? <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

  5. #5
    2 Star Lounger
    Join Date
    Jul 2001
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ADO and filters (VB6)

    We did not know it was not allowed until now, so now we are trying to figure out how to do this with some equivalent method that would create a similar result, basically this is what i want to do...

    I want to search the field DrawingDescription for any record containg the word Flange and not containg the word Bowl. sounds easy enough but gives an error as described earlier

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: ADO and filters (VB6)

    I don't know anything about your data source, but it seems a SQL string in the rs.Open method would give you the flexibility you need.

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: ADO and filters (VB6)

    I think Jefferson hit the nail on the head - put the NOT LIKE in the SQL statement. ADO only disallows NOT LIKE in the Filter property, not in an SQL statement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •