Results 1 to 9 of 9
  1. #1
    lmahere is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2016
    Posts
    11

    Extracting DOB from ID Number

    Hi Guys,



    I am trying to extract a date of birth from a South african ID number to be displayed in another field and then calculate the age which is alos dispalyed in another field. My problem is trying to extract the DOB from the 13digit ID number . The DOB is the first six numbers of the ID number e.g 8805256177085 . If anyone can help i would really appreciate it.

  2. #2
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    What format is this date? I guess in your example it's May 25th 1988? If so, then:
    Code:
    DOB = CDate(Mid(IdNumber, 3, 2) & "/" & Mid(IdNumber, 5, 2) & "/" & Left(IdNumber, 2))

  3. #3
    lmahere is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2016
    Posts
    11
    Hi Cyanidem ,

    The format for the date is short date 25/05/1988 . I am quite new to Access programming , so i have only been using pass through queries as i more accustomed to SQL . Where would i enter this code ?

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    You can use that formula to get the date of birth anywhere you need it, though primarily that'd be in queries etc then you could calculate their age based on the calculated date of birth.

  5. #5
    lmahere is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2016
    Posts
    11
    Thanks it worked like a charm you saved my life !!!!

  6. #6
    Tazmaniac is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2018
    Posts
    19
    Hi there

    Curious to know if the above will work the same on a SA ID number starting with e.g. 000121... In other words will it automatically populate the date of birth as 21/01/2000?

    And also if the age will calculate correct? =,18 Years?

  7. #7
    Join Date
    Apr 2017
    Posts
    1,679
    It works with 00... in case it is for year 2000, but what about people born in 1900 or 1915? How are such cases handled in RSA ID. Here in Estonia the 1st number of ID determines the century (and sex - odd for males, even for females).

  8. #8
    Tazmaniac is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2018
    Posts
    19
    Good question, don't know either.
    I need the formula for a database I am putting together and I will never have to capture a person born before 1980.
    Thanks for the reply.

  9. #9
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    if you want something a little less prone to mistakes than the CDATE() function, you can also use DATESERIAL(YYYY, MM, DD) and you'll end up with a date

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

Similar Threads

  1. Extracting number of files found by module
    By JeroenMioch in forum Access
    Replies: 4
    Last Post: 01-21-2016, 11:43 AM
  2. Extracting data from reports
    By Dhivya in forum Reports
    Replies: 3
    Last Post: 07-04-2014, 08:50 AM
  3. Extracting TRUE values only
    By kloun04 in forum Queries
    Replies: 3
    Last Post: 06-20-2014, 11:23 AM
  4. Extracting text from a field
    By bwash70 in forum Access
    Replies: 4
    Last Post: 11-24-2010, 08:10 PM
  5. Extracting data after a keyword
    By KerryA in forum Queries
    Replies: 1
    Last Post: 02-11-2010, 09:56 PM

Tags for this Thread

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