Results 1 to 6 of 6
  1. #1
    carstenhdk is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    May 2010
    Location
    Denmark
    Posts
    42

    Question Show age from social security number

    Hi

    I have a table with contacts. Their social security number is in the table as well. In danish it is in this format: dd-mm-yyyy-xxxx. I want a feild, that shows contacts age calculated from this number. Compare todays date with the number, and calculate the age in years.

    Thx in advance

  2. #2
    kimmer is offline Competent Performer
    Windows 7 Access 2010 (version 14.0)
    Join Date
    May 2010
    Posts
    100
    Expr1: DateDiff("yyyy",CDate(Left([danish social],10)),Now())

  3. #3
    carstenhdk is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    May 2010
    Location
    Denmark
    Posts
    42
    Ok, I think you misunderstood me.. :-)

    DD: date 1-31.
    MM: Month 1-12.
    YYYY: Year 0-2040?
    XXXX: Inividual number for each person. I shouldnīt mean anything in this case, but itīs a part of the number written in the feild ddmmyyyy-xxxx.

    How do I seperate the ddmmyyyy from the -xxxx? When the separation has been done, the date is compared with todays date, and the persons age is shown in the feild.

  4. #4
    kimmer is offline Competent Performer
    Windows 7 Access 2010 (version 14.0)
    Join Date
    May 2010
    Posts
    100
    Which is it... first you said dd-mm-yyyy-xxxx, then ddmmyyyy-xxxx

    The Left function is pulling the first 10 characters.
    Cdate is converting those characters to a date.
    Datediff is comparing the date with now and producting the difference, in years.

  5. #5
    carstenhdk is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    May 2010
    Location
    Denmark
    Posts
    42
    Ok, Iīm sorry about misunderstandings.. :-S

    Well, I donīt seem to get this right - by the way Iīve been veeery sleepy when I wrote this. There is only yy and not yyyy as written. :-/

    I have a number on a person 191184-0234. Person is born nov 19th 1984. The feild is set to have a input mask to secure, that no numbers are forgotten. The feild has a input mask: 000000-0000;0;_ The first 6 digits is the date that is relevant. How to do?

  6. #6
    kimmer is offline Competent Performer
    Windows 7 Access 2010 (version 14.0)
    Join Date
    May 2010
    Posts
    100
    To get the date:

    birthdate: CDate(Left([danish social],2) & "-" & Mid([danish social],3,2) & "-" & Mid([danish social],5,2))

    Calculate age:
    Age: DateDiff("yyyy", [Birthdate], Now())+ Int( Format(now(), "mmdd") < Format( [Birthdate], "mmdd") )
    Last edited by kimmer; 05-27-2010 at 04:38 PM. Reason: Colon D converted to a smilie

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

Similar Threads

  1. Making New Record Number Next Numerical Number
    By jhillbrown in forum Access
    Replies: 1
    Last Post: 03-10-2010, 11:06 AM
  2. Security..Is there another way?
    By marianne in forum Security
    Replies: 0
    Last Post: 07-19-2009, 07:18 PM
  3. User Security
    By Mike Mc in forum Security
    Replies: 1
    Last Post: 04-01-2009, 08:10 AM
  4. Sum Of Positive Number and Negative Number
    By maysamab in forum Reports
    Replies: 1
    Last Post: 10-20-2008, 04:06 PM
  5. Security Warning
    By mojo53777 in forum Security
    Replies: 0
    Last Post: 11-16-2007, 06:23 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