Results 1 to 4 of 4
  1. #1
    jaworski_m is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2015
    Posts
    25

    Null or unique value - table data validation rule

    Hello,

    How to set data validation rule at table level in such a way that only UNIQUE or NULL/EMPTY values can be entered?

    If index is set to no duplicates multiple null/empty values cannot be added to a table.



    Appreciate any hints.

    Marcin

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    you would not use validation rules for this.

    In a form you can have some code to ensure a new entry is unique etc, but in a table you would set the field index property to indexed - no duplicates.

    for numbers if you want to allow nulls then ensure the default value is left empty
    for text change allow zero length property to no

  3. #3
    jaworski_m is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2015
    Posts
    25
    Thank you for reply.

    Can you give me a hint how VBA should look like to handle both null and unique values?

    Thank you.

  4. #4
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    just rechecked my thinking and you can allow nulls in the index

    in table design, click on the indexes option in the ribbon, then select the index required and change ignore nulls to yes (and unique to yes if not already done)

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

Similar Threads

  1. Replies: 2
    Last Post: 06-16-2015, 03:52 AM
  2. Replies: 2
    Last Post: 12-27-2013, 07:32 AM
  3. Validation Rule by relating the data with table
    By Falahuddin in forum Access
    Replies: 14
    Last Post: 12-23-2013, 07:15 PM
  4. Data entry validation rule in Form
    By accessn00bie in forum Access
    Replies: 3
    Last Post: 12-07-2012, 01:11 PM
  5. Referencing table data in field validation rule
    By toad848 in forum Database Design
    Replies: 3
    Last Post: 03-19-2009, 07:03 AM

Tags for this Thread

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