Hi Viorel,
Your suggestion works, but it now returns "2097-01-31" if the birthdate is "1997-01-31".
I assume it is because of the DateSerial being 2000. How will I distinguish between birth year 1900-1999 and 2000-2999?
I am coding as follows:
Dim MyStr as Date
tempidholder = Format(Str(IDNumber), "0000000000000") 'This is to convert the number to string
.
.
.
If Left(tempidholder, 1) = "0" Then
FinalStr = Left(tempidholder, 6) 'Stores just the first 6 digits
MyStr = DateSerial(2000 + Left(FinalStr, 2), Mid(FinalStr, 3, 2), Mid(FinalStr, 5, 2))
BirthDate = MyStr 'If first 6 digits is "000131", returns "2000-01-31". If first 6 digits is "04-01-31" returns "2004-01-31" - all correct
Else
FinalStr = Left(tempidholder, 6)
MyStr = DateSerial(2000 + Left(FinalStr, 2), Mid(FinalStr, 3, 2), Mid(FinalStr, 5, 2))
BirthDate = MyStr 'If first 6 digits is "97-01-31", returns "2097-01-31" in stead of "1997-01-31"
End If
If I change the line "MyStr = DateSerial(2000 + Left(FinalStr, 2), Mid(FinalStr, 3, 2), Mid(FinalStr, 5, 2))" to read "MyStr = DateSerial(1900 + Left(FinalStr, 2), Mid(FinalStr, 3, 2), Mid(FinalStr, 5, 2))", I also get the wrong return.
.
.
.
Else
FinalStr = Left(tempidholder, 6)
MyStr = DateSerial(1900 + Left(FinalStr, 2), Mid(FinalStr, 3, 2), Mid(FinalStr, 5, 2))
BirthDate = MyStr 'If first 6 digits is "01-01-31", returns "1901-01-31" in stead of "2001-01-31"
End If
Thanks
Deon