Hi. I want to use the following code to check whether a date entered is valid.How do I cancel the update of the field if the date entered is not valid?
Private Sub DateofBirth_AfterUpdate()
'Test if applicant is under required age.....
Dim CurrentAge As Integer
If oCountry = "Samoa" Then
oModalAge = 18
ElseIf oCountry = "Tonga" Then
oModalAge = 21
ElseIf oCountry = "Liberia" Then
oModalAge = 18
ElseIf oCountry = "Fiji" Then
oModalAge = 21
Else
oModalAge = 18
End If
''CurrentAge = AgeYears(#12/31/1985#)
CurrentAge = AgeYears(Me.DateOfBirth)
If CurrentAge < oModalAge Then
MsgBox "Applicant must be at least " & CStr(oModalAge) & " years old!", , "CAVR - ATD": Exit Function
End If
End Sub