Results 1 to 2 of 2
  1. #1
    Leonidsg is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    68

    Calculation Query Which returns age in years and months between two dates

    Hello all,

    I have been desperately looking on the internet on how to make a query to calculate age in years and months between two dates. For example the two dates I am using is [DOB] (date of birth) and [DateDx] (date of diagnosis) from those two dates I would like to calculate [AgeDx] (age at diagnosis). I would like it read 2y 3m.

    I found this equation: iif(Format([ContCancDate]-[ContStartDate],"yy"" yrs ""mm"" mths""")="99 yrs 12 mths", "0 mths",Format([ContCancDate]-[ContStartDate],"yy"" yrs ""mm"" mths"""))

    but when I click "Show" and select the Table I wish to show it in then I get a syntax error about commas. But if show is checked but a table is not specified to show the calculation then it will save and work. But the problem is then I cant see it in the original table.

    Please help.

    Thank you,


    Lenny

  2. #2
    qa12dx is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    india
    Posts
    112
    took me a long time, tons of sweat & tears to figure it out. (pre google era)

    what u want is datediff function

    see how i did it. modify to suit ur needs. the "how u want to see it" is what u r trying to figure out. also included some more examples.

    i like this forum and don't want to point u to a outside web page, but there r lots of examples out there.

    cheers
    Attached Files Attached Files

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 07-10-2012, 06:23 AM
  2. Display Age in Years, Months, Days
    By jsimard in forum Programming
    Replies: 1
    Last Post: 01-18-2012, 08:08 PM
  3. Adding months to years in queries
    By TonyB in forum Queries
    Replies: 2
    Last Post: 07-29-2011, 09:29 AM
  4. Replies: 1
    Last Post: 06-09-2011, 09:15 AM
  5. Replies: 1
    Last Post: 11-12-2010, 01:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums