Results 1 to 6 of 6
  1. #1
    Phred is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2009
    Posts
    246

    Compatible Syntax issues with ANSI92 in form Validation settings

    Access 2007 front end, SQL Server 2008 R2 back end. All architecture completed. Starting design of first screen. This is my first combination Access to SQL Server development. Back end on Virtualized Server and Front end on Virtualized workstation. ODBC connection works. I am in a development environment. All architecture is complete and database generated to SQL Server.

    Under Access Options, Object Designers, Query design, I checked SQL Server Compatible Syntax (ANSI92) and This database. Made sense to me since the back end is all SQL Server. Most of my queries I understand will run fine in Access others may need to be pass-through to SQL. I get this. Here is what's happening.

    On the forms I disabled Autocorrect.

    On a form I am attempting to enter an expression for Validation in the properties of a field:

    Is Null OR Not Like “*[!0-9]*”



    No matter what I do it is auto changed to

    Is Null OR Not Alike “*[!0-9]*”

    I realize this is due to changing to ANSI92. However the only solution I found said to go back into the Access Options and reverse my selection of ANSI92. I have a lot of validation rules to write. Is there any other solution? Have I made the correct decision to change to ANSI92? Do I need to move all my validation (and other expressions) to VB instead? Will they function correctly in VB? Do they get written in ANSI92 in VB? Does anyone know of a list of other conflicts and issues with ANSI92? Since the whole back end is SQL Server it doesn’t seem to make much sense to switch away from ANSI92.

    Any insight is appreciated

    Phred

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    have you tried using the SQL version of a wildcard % instead of *

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    err ALIKE is also the SQL version of LIKE so you should be fine on that syntax apart from the wildcard

  4. #4
    Phred is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2009
    Posts
    246
    Thanks rpeare. That helps. The piece of data I am entering is a PIN (Property Index Number). The actual PIN must be all digits 0-9 and be exactly 14 digits long. The number is never calculated so the SQL data type is a Varchar(14). The dashes are just an Access Mask and the mask is set to store the data without the symbols in the mask.

    11-22-333-444-5555 passes the validation rule (Null or all characters 0-9). However I am having problems enforcing the exactly 14 digits. I have eliminated the Is Null OR Not Alike "%[!0-9]%" since it is functioning fine now and working on the 14 digits part.
    Is Null OR Alike "##############" but it isn't working. If you delibertly enter 13 digits it catches the error. If you go back and add 1 more digit to = 14 it still errors out.

    Is Null OR Alike "??????????????" doesn't seem to work either. Is there another ANSI92 problem here as well?

    After getting the rule to enforce 14 digits, I need to combine both validation rules into one rule.

    Thanks

    Phred

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    try

    len([Fieldname]) = 14

  6. #6
    Phred is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2009
    Posts
    246
    Is Null Or Not Alike "%[!0-9]%" AND Len([KPIN]) = 14

    Works great, thanks for your help.

    Phred

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

Similar Threads

  1. Replies: 0
    Last Post: 10-11-2013, 06:07 AM
  2. 2010 to 2007 compatible
    By libraccess in forum Access
    Replies: 2
    Last Post: 07-20-2013, 05:28 PM
  3. Replies: 1
    Last Post: 05-29-2013, 04:01 PM
  4. Replies: 1
    Last Post: 03-20-2013, 07:02 AM
  5. web compatible query and relationship
    By char in forum Access
    Replies: 3
    Last Post: 10-28-2012, 11:21 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