Results 1 to 3 of 3
  1. #1
    bambi_no89 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2016
    Posts
    2

    Validation Rule for one field, if the other has a yes or no box

    Hey all


    first of all: i use the german office 2013, so some of the terms are roughly translated by myself, but i hope you can figure out my problem.

    The Task:
    The Database is about a library. Some customers are eligible for an extended rental period
    In my Table one column is named "Extension" which is supposed to be a yes or no checkbox.
    Another column is named "Amount" for the amount of days the extension lasts

    Now i am supposed to place a validation rule with the following aspects:
    If the box @"extension" is marked YES , a value from 1 to 30 MUST be entered @"amount"
    If the box @"extension" is marked NO , no value is allowed/supposed to be entered @"amount"

    All the tries i did so far resulted in different errors (syntax errors or else)

    The closest i got so far:

    ([extension]="yes" AND [amount]>=1 AND <=30) OR ([extension]="no" AND [amount]=0)


    any ideas?
    thanks a lot

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    a checkbox has a Boolean datatype - -1/0, true/false or yes/no (no quotes). and you cannot use >= and <= as you have

    so try

    ([extension]=true AND [amount]>=1 AND [amount]<=30) OR ([extension]=false AND [amount]=0)

  3. #3
    bambi_no89 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2016
    Posts
    2
    It works, finally ^^
    Thank you

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

Similar Threads

  1. Validation Rule in Multi Value Field
    By lima in forum Access
    Replies: 3
    Last Post: 10-14-2014, 12:14 PM
  2. Replies: 3
    Last Post: 05-02-2012, 04:05 AM
  3. Validation rule for a month field
    By Alliana Gray in forum Access
    Replies: 7
    Last Post: 08-11-2011, 12:41 PM
  4. Referencing table data in field validation rule
    By toad848 in forum Database Design
    Replies: 3
    Last Post: 03-19-2009, 07:03 AM
  5. Validation rule for a text field
    By wasim_sono in forum Forms
    Replies: 4
    Last Post: 03-14-2006, 11:39 PM

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