Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Sep 2002
    Location
    Brookings, South Dakota, USA
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    age calculations (access xp)

    Hi, I know this has been posted but since I can't search I'll have to ask again. I need to find out how old students were at the time they took a test. I have this
    Expr1: INT((12/15/2002-[Students]![Birthdate])/365.25) in a calculated field in my query but end up with a negative number with two decimal places. How do I need to change this? Thanks, Tammy

    By the way, I really miss being able to search this forum. Any news on when that will function again?

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

    Re: age calculations (access xp)

    You must enclose a date in # symbols: #12/15/2002#, otherwise it will be interpreted as a calculation "12 divided by 15 divided by 2002".

    Another way is to use a function:

    Function Age(BirthDate, LaterDate) As Integer
    ' Returns the Age in years between 2 dates
    ' LaterDate must be after BirthDate
    Age = Year(LaterDate) - Year(BirthDate)
    If Month(LaterDate) < Month(BirthDate) Or (Month(LaterDate) = Month(BirthDate) And _
    Day(LaterDate) < Day(BirthDate)) Then
    Age = Age - 1
    End If
    End Function

    Use this in the form

    StudentAge: Age([Students]![BirthDate],#12/15/2002#)

    P.S. I'm very sorry, but I have no idea when the search function will be back. When there are new developments, they will be announced in the Newsflash.

  3. #3
    Lounger
    Join Date
    Sep 2002
    Location
    Brookings, South Dakota, USA
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: age calculations (access xp)

    Thanks Hans. Sometimes you miss the simplest things!!

Posting Permissions

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