Results 1 to 5 of 5
  1. #1
    thewatcher101 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Location
    Los Angeles
    Posts
    5

    Calculating Age based on DOB format YYYYMMDD

    I am having calculating current age because the birthdays are saved in that format.

  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
    Use DateSerial() to change it to a date with string functions (Left, Mid, Right).

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    convert to a real date
    vDat = mid([field],5,2) & "/" & mid([field],7,2) & "/" & left([field],4)

    vAge = DateDiff("yyyy",vDat,Date())

  4. #4
    thewatcher101 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Location
    Los Angeles
    Posts
    5
    Thank ranman, problem solved.

  5. #5
    thewatcher101 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Location
    Los Angeles
    Posts
    5
    I notice that the date is not accounted for in the calculations. So someone who was born 11/30 given today is 11/11 is round off, is there way to get date into the calculations?

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

Similar Threads

  1. How to covert yyyymmdd to mm/dd/yyyy
    By adnancanada in forum SQL Server
    Replies: 6
    Last Post: 10-20-2017, 04:30 PM
  2. Bulk convert DDMMYYYY to YYYYMMDD?
    By abm in forum Access
    Replies: 13
    Last Post: 08-20-2015, 01:06 PM
  3. Calculating from a query based subform
    By keiath in forum Forms
    Replies: 1
    Last Post: 10-09-2013, 02:59 AM
  4. Replies: 1
    Last Post: 09-06-2011, 05:24 AM
  5. Convert date format yyyymmdd for datediff
    By TEN in forum Programming
    Replies: 1
    Last Post: 06-17-2009, 09:35 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