Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2004
    Posts
    15

    Unanswered: calculating age at specific date

    I am trying to create a field that calculates a clients age at a particular date.

    I have a D/O/B field, a current age Field and also a Date at first appointment field. I tried the calculation:

    =datediff("yyyy",[D/O/B],[date of first appointment]) + Int (format)([date of first appointment],"mmdd")< Format ([D/O/B], "mmdd"))

    but this does'nt seem to work can anybody help me

    Cheers

  2. #2
    Join Date
    Apr 2004
    Location
    South Arica
    Posts
    125
    intMonths = DateDiff("m", dtDOB, dtJoinDate)
    or
    intYears = DateDiff("yyyy", dtDOB, dtJoinDate)

  3. #3
    Join Date
    Feb 2004
    Location
    Wales
    Posts
    343
    Hi may I ask WHY your storing age data instead of using calculation thus keeping you data bloat to a minium

    I have a very accurate calc that may be of use in either case - lat me know and ill e-mail to you as a quick fix routine


    regards

    gareth

  4. #4
    Join Date
    Apr 2004
    Posts
    15
    Hi not really 100% sure what you mean.

    I want to be able to do a search and find how many people of a certain age (say 30-40) attended a first appointment.

    I dont want their age to change as this may give me false data eg a person in 2004 may be 38 but in 2007 they will be 41. The query though would still be people between 30-40 and therefore this person would be out of the range even though he was 38 when he came to the appointment.

    I hope that all makes sense and if you think you can help me with a more efficient way of dealing with my problem i would be glad to here it.

    Cheers

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    see if one of these threads helps:

    List up-coming birthdays
    Calculate age?
    Birthday Reminder
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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