Results 1 to 4 of 4
  1. #1
    con-con
    Guest

    How do you sort odd and even years? (Access 97)

    I have a table with a year field populated with the 4 digit year code. How can I sort by odd or even years?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: How do you sort odd and even years? (Access 97)

    Do you mean you want to only display odd or even years or that you want to sort so that one or the other displays first, sorted sequentially within those groupings?

    You can't do it at all in a table unless you have another field that holds an odd or even indicator. You could do it in a query by creating an expression (calculated field) that returns a 0 if the number if even and a 1 if it is odd and then sorting first on that column and then on the year column. The expression would be something like

    Expr1:[YearCode] Mod 2
    Charlotte

  3. #3
    con-con
    Guest

    Re: How do you sort odd and even years? (Access 97)

    I would like to query for only even or odd years. I guess I worded the question wrong. But the indicator code you gave could work too. Thanks.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: How do you sort odd and even years? (Access 97)

    Sure, just set the critieria line to 1 or 0.
    Charlotte

Posting Permissions

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