Can someone please tell me what is wrong with my code below. I am attempting to extract a date of birth from a text file. I am able to convert the day and month portion of the date as seen at strDate3 but when I try to get the year, I get a "Run-Time Error 13, Type Mismatch"
In the text file the date of birth is stored as yyyyddd which is 1966031 for (01/31/66). I account for leap years by using the code "If ((strYear3 Mod 4 = 0) And (strYear3 Mod 100 <> 0) Or (strYear3 Mod 400 = 0)) Then .....
It is the if statement that generates the error message. When I comment out the "strYears3 = Mid(PULL_record, 229, 4), the code runs and returns the correct day and month
Dim strYear3
Dim strDate3
Dim Date_of_Birth As String
Dim strJulianDate
'strYear3 = Mid(PULL_record, 229, 4)
strDate3 = Mid(PULL_record, 233, 3)
strJulianDate = strYear3 & strDate3
If ((strYear3 Mod 4 = 0) And (strYear3 Mod 100 <> 0) _
Or (strYear3 Mod 400 = 0)) Then
.............
In the text file the date of birth is stored as yyyyddd which is 1966031 for (01/31/66). I account for leap years by using the code "If ((strYear3 Mod 4 = 0) And (strYear3 Mod 100 <> 0) Or (strYear3 Mod 400 = 0)) Then .....
It is the if statement that generates the error message. When I comment out the "strYears3 = Mid(PULL_record, 229, 4), the code runs and returns the correct day and month
Dim strYear3
Dim strDate3
Dim Date_of_Birth As String
Dim strJulianDate
'strYear3 = Mid(PULL_record, 229, 4)
strDate3 = Mid(PULL_record, 233, 3)
strJulianDate = strYear3 & strDate3
If ((strYear3 Mod 4 = 0) And (strYear3 Mod 100 <> 0) _
Or (strYear3 Mod 400 = 0)) Then
.............