Results 1 to 2 of 2

Thread: ADODB Recordset Filter problem

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    81

    ADODB Recordset Filter problem

    ADODB Recordset Filter problem

    dim rst as ADODB.Recordset
    set rst = new ADODB.Recordset
    rst.open select field1,field2 from table
    ..
    ..

    rst.Filter = "(field1 = 100)" it works!
    rst.Filter = "(field2 = 2 or field2 = 3)" it also works!

    but it doesnt work:
    rst.Filter = "(field1 = 100) and (field2 = 2 or field2 = 3)"
    //Error: wrong type or conflict between parameters..

    WHY?? plz help!!

  2. #2
    Fanatic Member joltremari's Avatar
    Join Date
    Sep 2000
    Location
    Mississippi
    Posts
    674

    Re: ADODB Recordset Filter problem

    You cannot join an OR group with an AND group. You will have to use something like this:
    VB Code:
    1. rst.Filter = (field1 = 100 And field2 = 2) Or (field1 = 100 And field2 = 3)
    There may be some quote("" '') issues with my example, you may have to tweak it a little.
    Hope this is helpful

    JO
    "I have not failed. I've just found 10,000 ways that won't work."
    'Thomas Edison'

    "If we knew what it was we were doing it wouldn't be called research, would it?"
    'Albert Einstein'

    VB6

Posting Permissions

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



Click Here to Expand Forum to Full Width