Results 1 to 2 of 2
  1. #1
    NEHicks is offline Novice
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    7

    Formulas?

    I need to have a field in a database that will calculate the age of a person, based on their DOB. I have it in the excel sheet that I imported into Access to create the data base, but it just copied the number that was already there. When I add new entries into the database, the age isn't calculated. How do I do this?



    The forumla I use in my spreadsheet is: =DATEDIF(O2,TODAY(),"y")

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    don't store calculated values in a table. common calculations like age should be done in queries or at the run time of a form or report.

    your formula would be similar (note, your formula likely is not calculating age correctly if it's in excel)

    PersonAge: datediff("yyyy", [Dob], Date()) - iif(DateSerial(Year(Date), Month(DOB), Day(DOB)) > Date, 0, 1)

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

Similar Threads

  1. Formulas
    By joh344 in forum Queries
    Replies: 33
    Last Post: 04-22-2014, 12:15 PM
  2. Expressions and formulas
    By kjcochran in forum Access
    Replies: 1
    Last Post: 03-25-2013, 02:19 PM
  3. Query Formulas
    By ShadeRF in forum Queries
    Replies: 8
    Last Post: 12-13-2011, 05:34 AM
  4. Formulas
    By dunnmel4 in forum Access
    Replies: 0
    Last Post: 03-27-2011, 04:59 PM
  5. Formatting formulas
    By katrinanyc926 in forum Queries
    Replies: 2
    Last Post: 08-16-2010, 07:52 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