How to Make a Table Calculate Age From a Birth Date in Microsoft Access

Written by ken burnside Google
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Make a Table Calculate Age From a Birth Date in Microsoft Access
Making a database calculate an age from a birthdate is a common programming task. (Thinkstock Images/Comstock/Getty Images)

Databases are used to track information, and in a human resources setting, two of the most important pieces of information are employee birthdates and current ages. Age calculation is helpful for managing benefits and insurance premiums and even scheduling surprise birthday parties. It is also a common practice exercise when learning the basic functions and properties in Microsoft Access, Microsoft's entry level and small business database program.

Skill level:
Easy

Other People Are Reading

Instructions

  1. 1

    Create a new form by clicking on the "Objects" tab and selecting "Forms." Select "Design View" in the dialogue box that comes up, and then click "OK." A database table will launch.

  2. 2

    Click on the "Text Box" field and create three text boxes for the form, labelled "Name," "Birthdate," and "Age," respectively.

  3. 3

    Click on the field for Birthdate and click "Properties" and set "Short Date." Click on Properties again and set the Name to "Birthdate."

  4. 4

    Click on the field for Age and click "Properties." Set the Name to "Age."

  5. 5

    Click on the field for Age and then click the "Properties" icon. Choose the "ControlSource" property, and enter the following:

    =DateDiff("yyyy", [Birthdate], Now())+ Int( Format(now(), "mmdd") < Format( [Birthdate], "mmdd") )

  6. 6

    Switch to "Form" view.

  7. 7

    Enter a name in the "Name" column, then enter a birthdate in the Birthdate column. The Age column will show the person's elapsed age from the date given in the birthdate field.

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.