hi i have the following code to evaluate the age entered. Only problem is that if the dob entered is after todays date, then i get both error messages come up. How can i modify this code to end after displaying 1 or the other error.
thanks
I keep getting errors about end if's and end sub expected. I know what i'm trying to do, but just can't get this to work as i want it to.
Please help!!
thanks
Code:
Private Sub DOB_AfterUpdate()
Dim errr, BirthDate As Date
BirthDate = Date
errr = 0
If DOB > BirthDate Then
MsgBox ("The Date Of Birth Cannot Be After Today!" & (Chr(13) & Chr(10)) & (Chr(13) & Chr(10)) & "That's Just Not Possible!" & (Chr(13) & Chr(10)) & (Chr(13) & Chr(10)) & "Please Check The Date Of Birth."), vbExclamation, "Ooopps....You Made A Mistake!"
DOB.SetFocus
errr = errr + 1
If errr = 1 Then End Sub
If age < 11 Or age > 22 Then
MsgBox ("Cadets Should Be At Least 13 Years Old." & (Chr(13) & Chr(10)) & "And A Maximum Of 23 Years." & (Chr(13) & Chr(10)) & (Chr(13) & Chr(10)) & "Please Check The Date Of Birth."), vbExclamation, "Ooopps....You Made A Mistake!"
DOB.SetFocus
errr = errr + 1
End If
End If
End Sub
I keep getting errors about end if's and end sub expected. I know what i'm trying to do, but just can't get this to work as i want it to.
Please help!!