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

    Validation Rule - Unique text in Form regarding based table

    Hello



    It's my First post at this forum so please be forgiving.

    I have a Form based on Table with Products. I have a field with EAN Codes - they are indexed and only unique text are allowed. My form is for adding new products into Table.Products. When i add a product with EAN Code that arleady exists i have access error - it's normal because of ean's unique field property in table.

    But i dont want to have this error i want to use Validation Rule in Form field to have my own text if new ean doesn't meet the validation rule.

    Please help me create this Validation Rule.

    Regards
    Kamil

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    I don't think you can do it with a validation rule. I'd suggest a small routine to see if the record already exists.
    Typically this is done with a DCount function.

    In plain English, using the "text that should be unique", you check to see if there is a record already in the table with that "text". If the DCount is > 0, then the "text value" already exists - so give a message that that record already exists.

  3. #3
    Kimal is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Dec 2013
    Posts
    2
    OK I Will try with before update :>

    Thx

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

Similar Threads

  1. Validation Rule by relating the data with table
    By Falahuddin in forum Access
    Replies: 14
    Last Post: 12-23-2013, 07:15 PM
  2. Form Validation Rule
    By galkej in forum Forms
    Replies: 4
    Last Post: 07-01-2012, 06:38 PM
  3. Validation Rule in Table vs. Form
    By LanieB in forum Forms
    Replies: 2
    Last Post: 03-12-2012, 03:27 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