A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

E-mail address validation



 
 
Thread Tools Display Modes
  #1  
Old September 8th, 2009, 04:57 AM posted to microsoft.public.access.tablesdbdesign
TBell506
external usenet poster
 
Posts: 1
Default E-mail address validation

Is there a way to set up a field where there's validation that the format is
a valid email address? For example, I have any number of characters before
the @ symbol then any number of characters before the . symbol then three
characters. Does that make sense? Any help would be really great! Thanks
in advance.
Tracy
  #2  
Old September 8th, 2009, 06:29 AM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default E-mail address validation

On Mon, 7 Sep 2009 20:57:01 -0700, TBell506
wrote:

Is there a way to set up a field where there's validation that the format is
a valid email address? For example, I have any number of characters before
the @ symbol then any number of characters before the . symbol then three
characters. Does that make sense? Any help would be really great! Thanks
in advance.
Tracy


What makes you think that's the only valid email addresses possible?



would be a perfectly valid address. So would



This isn't a trivial problem at all!
--

John W. Vinson [MVP]
  #3  
Old September 8th, 2009, 07:24 AM posted to microsoft.public.access.tablesdbdesign
Allen Browne
external usenet poster
 
Posts: 11,706
Default E-mail address validation

Simplest approach would be to open your table in design view, and add a
validation rule on the field.

Something like this:
Is Null OR ((Like "*?@?*.?*") AND (Not Like "*[ ,;]*"))
where you put the invalid characters inside the square brackets.

For an explanation of validation rules, see:
http://allenbrowne.com/ValidationRule.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"TBell506" wrote in message
...
Is there a way to set up a field where there's validation that the format
is
a valid email address? For example, I have any number of characters
before
the @ symbol then any number of characters before the . symbol then three
characters. Does that make sense? Any help would be really great!
Thanks
in advance.
Tracy


  #4  
Old September 8th, 2009, 07:10 PM posted to microsoft.public.access.tablesdbdesign
David W. Fenton
external usenet poster
 
Posts: 3,373
Default E-mail address validation

=?Utf-8?B?VEJlbGw1MDY=?= wrote
in :

Is there a way to set up a field where there's validation that the
format is a valid email address? For example, I have any number
of characters before the @ symbol then any number of characters
before the . symbol then three characters. Does that make sense?
Any help would be really great! Thanks in advance.


I've cribbed this Regular Expression from others. I use it in the
email scripts on my web pages:

^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$

This informative, pragmatic and sensible article:

http://www.regular-expressions.info/email.html

....considers the subject and the drawbacks of various approaches. It
even offers the RegEx that is supposed to implement the exact RFC
for valid email addresses. Here it is:

(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(
?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b
\x0c\x0e-\x7f])*")@(??:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](
?:[a-z0-9-]*[a-z0-9])?|\[(??:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\
..){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]?:[\
x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e
-\x7f])+)\])

Wisely, that article recommends *not* using this RegEx.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
  #5  
Old September 8th, 2009, 09:12 PM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default E-mail address validation

On 8 Sep 2009 18:10:04 GMT, "David W. Fenton"
wrote:

It
even offers the RegEx that is supposed to implement the exact RFC
for valid email addresses. Here it is:

(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(
?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b
\x0c\x0e-\x7f])*")@(??:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](
?:[a-z0-9-]*[a-z0-9])?|\[(??:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\
.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]?:[\
x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e
-\x7f])+)\])

Wisely, that article recommends *not* using this RegEx.


Thanks, David!

As I said: not trivial!
--

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:51 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.