Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Oct 2001
    Location
    St. Augustine, Florida, USA
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calculate age in query (Access 2000)

    I use Access 2000. In a query I set up a field to calculate the age of an individual using the following expression: Age: DateDiff("y",[Member DOB], Date())/365.25 I received the answer in years but with 10 decimal places. How can I get the answer in simply years?

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calculate age in query (Access 2000)

    As you don't need the decimals, use Int(DateDiff("y",[Member DOB], Date())/365.25)
    Francois

  3. #3
    Star Lounger
    Join Date
    Dec 2001
    Location
    Birmingham, Alabama USA
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calculate age in query (Access 2000)

    Actually you should be using "yyyy" as the "Interval" argument in the DateDiff function ... not "y".
    The "y" argument returns the "Day of Year".

    Here is an expression I always use:

    DateDiff("yyyy", DOB, Date) + (Date < DateSerial(Year(Date), Month(DOB), Day(DOB)))

    HTH
    RDH
    Ricky Hicks
    Microsoft MVP
    Birmingham, Alabama USA

  4. #4
    New Lounger
    Join Date
    Oct 2001
    Location
    St. Augustine, Florida, USA
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calculate age in query (Access 2000)

    Francois thanks for the help!

Posting Permissions

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