How to validate email addresses in Access?

后端 未结 1 868
孤街浪徒
孤街浪徒 2021-01-19 03:51

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

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

but thi

相关标签:
1条回答
  • 2021-01-19 04:29

    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 "%[ ,;]%"))
    
    0 讨论(0)
提交回复
热议问题