Results 1 to 3 of 3
  1. #1
    denl10 is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2010
    Location
    Seattle
    Posts
    1

    Change DOB to age

    Hello,



    I have two fields "birthdate" and "datetested" in my database. I would like to create another field called "age" that is automatically filled in from the value in the 'birthdate' field, but relative to the "datetested" field. In other words I want to know the age of the person when he/she was evaluated. I'm not sure where to begin in terms of the code. Any help is appreciated.

    Thanks,

    Dennis

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    That calculation can *always* be done in a query at any time. There is no reason to use a field for this information.

  3. #3
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows XP Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    Try this

    If Month(DateToday) < Month(Bdate) Or (Month(DateToday) = _
    Month(Bdate) And Day(DateToday) < Day(Bdate)) Then
    Age = Year(DateToday) - Year(Bdate) - 1
    Else
    Age = Year(DateToday) - Year(Bdate)
    End If
    End Function

    If it does not work for you then google "access age"

    And yes RG is correct this should be done at runtime and not stored.

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

Similar Threads

  1. Change the display of Yes/No answers
    By winter in forum Forms
    Replies: 2
    Last Post: 08-11-2009, 09:06 AM
  2. Change the value of a field
    By akhilash in forum Queries
    Replies: 0
    Last Post: 07-16-2009, 07:20 AM
  3. change() on the textbox
    By skywalker in forum Forms
    Replies: 0
    Last Post: 03-01-2009, 01:28 AM
  4. Name Change
    By skip17 in forum Access
    Replies: 0
    Last Post: 01-12-2009, 01:28 PM
  5. Change of label size
    By Zoroxeus in forum Programming
    Replies: 0
    Last Post: 06-11-2007, 08:18 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