Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2010
    Posts
    1

    Unanswered: Creating database tables help with calculating age

    OK so I am new here so do guide me. My last tangle with MS access was back in 2002. Now my boss has asked me to start another database for her and I was trying to capture age of the participant.

    I have the the table design as follows :
    Name of Participant(Text Format)
    Birthdate(Date Format)
    Age(Number Format)

    The idea is for the age field to update itself everytime someone views it and when the data is created, the age would auto calculate once birthdate is entered. Is it possible? I tried using the following input mask to no avail:

    =DateDiff(yyyy,[Birthdate],Now())+(Format([Birthdate],mmdd)>Format(Now(),mmdd))

    Some advise please?

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    the manual should be able to help you on the correct syntax, its after all only a F1 key away. its even easier if you highlght the word you want to seach for then press f1
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jun 2007
    Location
    Maitland NSW,Australia
    Posts
    388
    You could also Search this forum using Calculate Age as your criteria. This will display many examples of Age calculations.

  4. #4
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    DateDiff("yyyy",[BirthDate],Date()) will give you a person's age. However, you should probably not store the age. A person's age is considered a calculated field. If you know a person's birthday then you can always figure out how old they are.

    If you store the number in a table then you run the risk of the data becoming stale or out of date. It also takes up space. Unless you are concerned about performance then it is good database design to store data and use queries to calculate fields. Adding:

    DateDiff("yyyy",[BirthDate],Date()) AS Age

    to a query would do the age calculation for you and you can use the query to feed your report or you form.

Posting Permissions

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