in the following code I am able to get the age of a person based on the year but not on the month... for example a person born june 26 1986 is written as being 27 but they shuld be 26 untill its past june of this year. What changes if possible must be made to use the month properly?
Code:
Private Sub Command1_Click()
Open "C:\Test\Patient.txt" For Output As #2
sPatientDoB = "06-26-86"
dateDOb = DateSerial(Mid$(sPatientDoB, 7, 2), Mid$(sPatientDoB, 1, 2), Mid$(sPatientDoB, 4, 2))
age = DateDiff("yyyy", dateDOb, Date$)
Print #2, age
Close #2
End Sub