4

I need to validate an email field in a table in Access 2010. I tried:

Is Null OR ((Like "*?@?*.?*") AND
  (Not Like "*[ ,;]*"))

but this did not work.

enter image description here

J.Olufsen
  • 13,415
  • 44
  • 120
  • 185
  • Please explain what you mean by "did not work". I just tried that validation rule (which appears to have come from [here](http://allenbrowne.com/ValidationRule.html)) and it worked for the most common cases. It's not bullet-proof, but I'm sure that it is sufficient for lots of applications. – Gord Thompson May 29 '13 at 19:15

1 Answers1

7

It appears that your database is in ANSI 92 mode, and when you pasted in the rule...

Is Null OR ((Like "*?@?*.?*") AND (Not Like "*[ ,;]*"))

...Access automatically changed Like to ALike, producing...

Is Null Or ((ALike "*?@?*.?*") And (Not ALike "*[ ,;]*"))

The problem is that ALike uses the ANSI wildcard characters, so you need to change the rule to

Is Null Or ((ALike "%_@_%._%") And (Not ALike "%[ ,;]%"))
Gord Thompson
  • 116,920
  • 32
  • 215
  • 418