A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Age Limit Validation Rule



 
 
Thread Tools Display Modes
  #1  
Old October 31st, 2008, 03:38 PM posted to microsoft.public.access.tablesdbdesign
normanlives8
external usenet poster
 
Posts: 1
Default Age Limit Validation Rule

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...?
  #2  
Old October 31st, 2008, 04:17 PM posted to microsoft.public.access.tablesdbdesign
Ken Snell \(MVP\)
external usenet poster
 
Posts: 2,506
Default Age Limit Validation Rule

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" wrote in message
...
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...?



  #3  
Old October 31st, 2008, 10:26 PM posted to microsoft.public.access.tablesdbdesign
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default Age Limit Validation Rule

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

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Ken Snell (MVP)" wrote in message
...
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" wrote in message
...
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...?





  #4  
Old November 1st, 2008, 04:08 AM posted to microsoft.public.access.tablesdbdesign
Ken Snell \(MVP\)
external usenet poster
 
Posts: 2,506
Default Age Limit Validation Rule

That would work as well.
--

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


"Douglas J. Steele" wrote in message
...
Why not just compare the date being input to DateAdd("yyyy", -18, Date())?




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:57 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.