Results 1 to 3 of 3
  1. #1
    domtriga is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2013
    Posts
    2

    New to Access. Need help with age validation rule.


    I need help with my validation rule.

    I need to have the field only allow data to have certain birthdates(In the mm/dd/yyyy format). And to only allow people to sign up if you're between 16 and 70 years old. My instructor asked us to use the Now() function to do this.

    I basically got this, and it's not really working at all.

    The field is BirthDate

    Code:
    "(Now()-[BirthDate]/365)>=16" And "(Now()-[BirthDate]/365)<=70"


    My instructor assigned this on my second week so any help would be greatly appreciated.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Try:
    DateDiff("d",[BirthDate],Date())/365 BETWEEN 16 AND 70

    Or use Now() in place of Date()
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    domtriga is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2013
    Posts
    2
    That worked and thank your for this.. But is there anyway you can do it with the Now() function?

    I think he will be ok with this but I just want to know how to do it with Now()

    EDIT: Nevermind, I just replaced Date() with Now() and it also works!!

    Thank you so much. I will definitely be browsing these forums more often, especially with this class.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Validation Rule
    By lynnmc26 in forum Access
    Replies: 1
    Last Post: 03-05-2012, 11:45 PM
  2. Validation Rule
    By rbiggs in forum Forms
    Replies: 4
    Last Post: 08-23-2011, 05:24 PM
  3. Validation Rule
    By ritzzy in forum Access
    Replies: 1
    Last Post: 04-13-2011, 01:33 PM
  4. Validation Rule
    By Megan in forum Access
    Replies: 1
    Last Post: 11-05-2010, 09:45 AM
  5. Validation Rule
    By smitstev in forum Access
    Replies: 5
    Last Post: 06-30-2009, 09:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums