Determining if age <=xx

  • Thread starter Thread starter DubboPete
  • Start date Start date
D

DubboPete

Hi all,

Jeff gave me a great bit of code for error checking, and I want to use
something similar to see if a person tries to enter a restricted area if
they are too young. No, it's not adult-related, but a student
work-experience issue.

This is what I thought would work, but it doesn't. Can someone help me
correct it?

'If the person is 16 or younger, then they get booted...
'[YOB] is year of birth

If Me![YOB].Value >= DatePart("yyyy", Date - 16) Then
msgbox "You are too young to use this section of the database",
vbInformation
Exit Sub
End If

thanks in anticipation

DubboStigOfTheDumpPete
 
Back
Top