Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Mar 2003
    Location
    Canton, Ohio, USA
    Posts
    103
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Query Criteria (Access 2000)

    I have a number of queries in an Access database that count using two criteria. The first is a name, and the second is a number. The number field uses criteria such as <200 or >500. This has all worked out great until now when I now need a criteria of odd or even. Instead of the query counting everything under a hundred, I now need to count all the odd numbers, or all the even numbers. I that at all posible?

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Query Criteria (Access 2000)

    The most common way of dealing with the odd/even problem is to divide the number by two in an expression and see if there is a remainder, or alternatively to divide by two, make it an Integer, and then multiply it by 2 and see if you get the same number. That can easily be done in an expression in a query, and then do the counting.
    Wendell

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

    Re: Query Criteria (Access 2000)

    Wendell has already mentioned some ways to do what you want. Another one is to create a calculated column [FieldName] Mod 2 (with the appropriate field name substituted). If the field value is even, the calculated column will be 0.

Posting Permissions

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