Results 1 to 6 of 6
  1. #1
    Father John is offline Novice
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Location
    Queens, New York City
    Posts
    2

    Unhappy Date of Birth Access expression

    We are somewhat new to Access. We are a Monastery and we are trying to go from the 8th century to the 21st.


    We have a database that has a date field. We would like to put a calculated field in a form to show the age of the person. I know how to put it in the form but none of the expressions I used work. =date() - [DOB] does not work.
    Can someone give us an expression that would do this? Thank You.
    God Bless,
    Father John

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    that expression will most likely give you the number of days between today and their DOB. it doesn't work? you mean, gives the wrong answer? try the following in the control source:
    Code:
    =datediff("yyyy", [DOB], date())
    that will not always be reliable though, based on whether or not this year's bday has passed. to be truly reliable, a small function is really needed.

  3. #3
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Below is a link to a variety of functions created by different developer's to calculate the difference between two dates, which can also be used for Age Calculations.

    Maybe this will be of help...


    Rogers Access Library

    http://www.rogersaccesslibrary.com/f...-dc18595c.html

  4. #4
    bcmarshall is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2010
    Posts
    95
    I didn't see this post until now. If your desire is to create an expression that calculates the age of a person as of today, then I have already done exactly that.

    =Int(DatePart("yyyy",Date()-[Forms![YourForm]![DOB])-1900)

  5. #5
    Father John is offline Novice
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Location
    Queens, New York City
    Posts
    2

    Thank You BCMarshall

    Thank you for the more precise formula. The one another user sent me works if you have not passed the birthday. Yours looks like it will work better.

    Thank you and God Bless

    Father John

  6. #6
    bcmarshall is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2010
    Posts
    95
    It will always return the age today regardless of when the birthday is.

    Have fun!

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

Similar Threads

  1. Calculate age from birth date
    By mick in forum Forms
    Replies: 2
    Last Post: 07-03-2010, 04:31 PM
  2. Using Regular Expression $ in Access Queries
    By rkdiekhoff in forum Queries
    Replies: 1
    Last Post: 01-20-2010, 12:50 PM
  3. Replies: 1
    Last Post: 09-09-2009, 04:42 AM
  4. Write excel expression in access
    By ktmchugh in forum Queries
    Replies: 0
    Last Post: 07-01-2009, 02:47 PM
  5. Replies: 0
    Last Post: 11-04-2006, 02:31 AM

Tags for this Thread

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