Results 1 to 2 of 2
  1. #1
    Argus is offline Novice
    Windows Vista Access 2007
    Join Date
    Aug 2009
    Posts
    1

    Question Number convert to date

    Hello, i have 11 digits number, example 37704252536. Its personal code and boldet&underlined digits are birth date. Me needs that I can from this numer to calculate age a person. How I can do it?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try this function in a standard module:
    Code:
    Function ReturnAge(InString As String) As Integer
       Dim DOB As Date
       DOB = DateValue(Mid(InString, 4, 2) & "/" & _
                       Mid(InString, 6, 2) & "/" & _
                       Mid(InString, 2, 2))
    
       ReturnAge = DateDiff("yyyy", [DOB], Date) + _
                   Int(Format(Date, "mmdd") < Format([DOB], "mmdd"))
    End Function

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

Similar Threads

  1. Convert date format yyyymmdd for datediff
    By TEN in forum Programming
    Replies: 1
    Last Post: 06-17-2009, 09:35 PM
  2. Replies: 1
    Last Post: 06-11-2009, 05:40 PM
  3. how to convert week number to date range
    By qwang1115 in forum Access
    Replies: 1
    Last Post: 02-13-2009, 11:35 AM
  4. Convert string to date
    By ~SwAmPdOnKeY~ in forum Queries
    Replies: 4
    Last Post: 09-11-2008, 07:19 PM
  5. date/time number
    By playfuljade in forum Forms
    Replies: 4
    Last Post: 12-19-2005, 12:52 PM

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