Results 1 to 2 of 2

Thread: ADO Recordset Filter Property

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Location
    Louisiana
    Posts
    2

    ADO Recordset Filter Property

    I have a disconnected recordset that I am trying to do some ambitious filtering with. I know how to get what I need with a SQL filter but they do not work as an ADO recordset filter.
    example: (SQL) Job > 100 AND Job < 200 AND Cost >
    100
    but ADO.Filter needs it like
    (Job > 100 AND Cost > 100) OR (Job < 200 AND Cost > 100)
    which returns an incorrect set

    Any help on filtering multiple columns by multiple values with the ADO filter property would be greatly appreciated

  2. #2
    Lively Member HeVa's Avatar
    Join Date
    Jul 2001
    Location
    DC
    Posts
    115
    tjfse2000:

    (Job > 100 AND Cost > 100) OR (Job < 200 AND Cost > 100)
    is not logically equivalent to

    Job > 100 AND Job < 200 AND Cost >100
    The filter that you tried to use just returns records that meet the second criterion (cost > 100) because of your use of the OR operator. If you stick an AND in there instead, it should work. But I don't understand why you need to do that. There are no special limitations on ADO recordset filters that would require such a mess. Your original idea should work, just put some parentheses around the different criteria, like so:

    Code:
    rst.Filter = "(job > 100) and (job < 200) and (cost > 100)"
    This works for me.
    H e*V a

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