Age Limit Validation Rule

N

normanlives8

We are trying to limit the age when imputting the data on forms.
We have the customers DOB in format (dd/mm/yyyy)and are trying to limit the
age to 18.
Are there any validation rules to help us achieve this...?
 
K

Ken Snell \(MVP\)

You can use a table-level validation rule for this.

Open the table in Design view, click on Properties icon on toolbar, and
enter this expression in the Validation Rule box:

DateDiff("yyyy",[mydate],Date())+(Format("Date","mmdd")<Format([mydate],"mmdd"))>=18

Close the Properties window and save the table.
 
D

Douglas J. Steele

Why not just compare the date being input to DateAdd("yyyy", -18, Date())?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Ken Snell (MVP) said:
You can use a table-level validation rule for this.

Open the table in Design view, click on Properties icon on toolbar, and
enter this expression in the Validation Rule box:

DateDiff("yyyy",[mydate],Date())+(Format("Date","mmdd")<Format([mydate],"mmdd"))>=18

Close the Properties window and save the table.
--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


normanlives8 said:
We are trying to limit the age when imputting the data on forms.
We have the customers DOB in format (dd/mm/yyyy)and are trying to limit
the
age to 18.
Are there any validation rules to help us achieve this...?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top