I am trying to calculate the age in a field of a form through the date of birth, but it returns me the compilation error 13 type mismatch
. Please someone help me? Here is the CODE.
Private Sub CmbCalcular_Click()
Dim datanasc As Date, idade As Integer
datanasc = CDate(MskDataNasc.Mask)
idade = CInt((Date - datanasc) / 365)
TxtIdade = Str(idade) & "anos"
End Sub