Results 1 to 6 of 6
  1. #1
    cris6381 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Sep 2013
    Posts
    3

    Current age calculation in a query


    I need to calculate current age of person from DOB in a query that can later be summarized by gouping all of the same age together in a report. Help, please.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    cris6381 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Sep 2013
    Posts
    3
    I checked out the link you provided but it talks about getting age calculation in a form. I have done that already but want to be able to do it in a query so that it can be incorporated into a report with other summarized information.

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Quote Originally Posted by cris6381 View Post
    I checked out the link you provided but it talks about getting age calculation in a form. I have done that already but want to be able to do it in a query so that it can be incorporated into a report with other summarized information.
    So why not create a field in the query that calculates the age using the expression.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    cris6381 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Sep 2013
    Posts
    3
    I would if I could get it to work, but it doesn't. I'm by no means a pro at Access but have researched and can't figure out a way to get it into a query. I've found some articles that say it doesn't work in a query at all so not sure. The calculation for a form is all I could find. Can't even get it to work in the main table. I may be way off base with what I'm trying but if someone could give me detailed steps, I would greatly appreciate it. Thanks!

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    DateDiff certainly will work in a query. However, not understanding the calc in that link.

    "It doesn't work" doesn't help us help you. What happens - error message, wrong results, nothing?

    Post the SQL statement for analysis. Something like:

    SELECT *, DateDiff("yyyy", [Birthdate], Now()) AS Age FROM tablename;


    How precise do you want the age calc? That calc rounds to whole year. Anyone born in 2013 will have age 0. Birthdate of 2003 will show 10 years even if BD was 1/1/2003.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Calculation Field in table vs Query calculation
    By Leonidsg in forum Database Design
    Replies: 18
    Last Post: 02-28-2013, 09:38 PM
  2. Query Calculation
    By Rhubie in forum Queries
    Replies: 4
    Last Post: 02-01-2013, 12:35 PM
  3. Query Calculation
    By Rhubie in forum Access
    Replies: 3
    Last Post: 08-28-2012, 01:41 PM
  4. IIF() in a query calculation
    By bbylls in forum Queries
    Replies: 4
    Last Post: 12-03-2009, 04:42 PM
  5. Query Calculation
    By kellyd in forum Queries
    Replies: 5
    Last Post: 08-31-2009, 11:14 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