[AccessD] Validation Rule and Hyphen

Heenan, Lambert Lambert.Heenan at aig.com
Tue Feb 10 15:00:23 CST 2015


My regular expressions are a bit rusty, but isn't the hyphen a character used to construct regular expressions? In which case to include it in your validation you would need to escape the hyphen. Now what's the escape character?


Lambert  


-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David Emerson
Sent: Tuesday, February 10, 2015 2:06 PM
To: AccessD
Subject: [AccessD] Validation Rule and Hyphen

Hi Listers,

 

I have a field for entering in a last name.  I want to restrict the characters to letters, spaces, apostrophes, and hyphens.

 

In the Validation Rule I have:

 

Is Null Or Not Like "*[!a-z OR "" "" OR ""'"" OR ""-""]*"

 

This works fine except when I enter a hyphen into the field it is rejected.
I can enter letters, spaces, and apostrophes.  All other characters are rejected.

 

Why are hyphens also rejected?

 

Regards

David Emerson
Dalyn Software Ltd
Wellington, New Zealand

 

 

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list