• Calculate age in query (Access 2000)

    Author
    Topic
    #367128

    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?

    Viewing 0 reply threads
    Author
    Replies
    • #571586

      As you don’t need the decimals, use Int(DateDiff(“y”,[Member DOB], Date())/365.25)

      • #571650

        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

      • #571747

        Francois thanks for the help!

    Viewing 0 reply threads
    Reply To: Reply #571586 in Calculate age in query (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel