Age Limit Validation Rule

Discussion in 'Microsoft Access Database Table Design' started by normanlives8, Oct 31, 2008.

  1. normanlives8

    normanlives8 Guest

    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...?
     
    normanlives8, Oct 31, 2008
    #1
    1. Advertisements

  2. 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
    news:...
    > 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...?
     
    Ken Snell \(MVP\), Oct 31, 2008
    #2
    1. Advertisements

  3. 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
    news:...
    > 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
    > news:...
    >> 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...?

    >
    >
     
    Douglas J. Steele, Oct 31, 2008
    #3
  4. That would work as well.
    --

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


    "Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_gmail.com> wrote in message
    news:%...
    > Why not just compare the date being input to DateAdd("yyyy", -18, Date())?
     
    Ken Snell \(MVP\), Nov 1, 2008
    #4
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tim Ferguson

    Re: Help with validation rule

    Tim Ferguson, Jul 16, 2003, in forum: Microsoft Access Database Table Design
    Replies:
    0
    Views:
    528
    Tim Ferguson
    Jul 16, 2003
  2. Mercy

    Record Validation rule between a table entry and a query result?

    Mercy, Aug 13, 2003, in forum: Microsoft Access Database Table Design
    Replies:
    2
    Views:
    719
    Mercy
    Aug 13, 2003
  3. J. Thomas Coons

    validation rule violations when there are no validation rules!

    J. Thomas Coons, Sep 25, 2003, in forum: Microsoft Access Database Table Design
    Replies:
    0
    Views:
    509
    J. Thomas Coons
    Sep 25, 2003
  4. Anna

    Age Validation Rule

    Anna, Feb 3, 2004, in forum: Microsoft Access Database Table Design
    Replies:
    3
    Views:
    2,072
    John Vinson
    Feb 4, 2004
  5. Awibble

    Age Validation

    Awibble, Mar 3, 2011, in forum: Microsoft Access Database Table Design
    Replies:
    1
    Views:
    573
    Awibble
    Mar 10, 2011
Loading...

Share This Page