Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2016
    Posts
    13

    A validation rule problem with DAO

    Hello,
    I'm practising using DAO to create table, field etc. by following an access programming book


    In a part of codes I copied from a hand-on file of the book...
    Code:
    Set fld = tblNew.CreateField("AgentID", dbText, 6)
        fld.ValidationRule = "Like 'A*'"
        fld.ValidationText = "Agent ID must begin with the " & _
        "letter 'A' and cannot contain more than 6 characters."
        tblNew.Fields.Append fld
    As you can see that the validation rule is Like 'A*'. However, When switching to
    the access interface, the validation rule is ALike 'A*' (where does the A come from?).
    And when typing in an AgentID field's cell, it showed a message box of the validation text even though
    I typed 'A' as the first letter.

    Does anyone know how to solve the problem?
    Thank you.

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716

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

Similar Threads

  1. Using VBA instead of Validation Rule
    By Mearntain in forum Access
    Replies: 16
    Last Post: 07-23-2015, 01:48 PM
  2. Replies: 2
    Last Post: 06-16-2015, 03:52 AM
  3. Validation Rule
    By Darkladymelz in forum Reports
    Replies: 2
    Last Post: 09-15-2011, 07:43 AM
  4. Validation Rule Help!
    By confidego in forum Access
    Replies: 8
    Last Post: 07-20-2011, 12:54 PM
  5. Validation Rule
    By robomose in forum Access
    Replies: 1
    Last Post: 09-09-2009, 05:59 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