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 » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Validating Email Address



 
 
Thread Tools Display Modes
  #1  
Old December 31st, 2009, 03:17 AM posted to microsoft.public.access.queries
Steve Stad
external usenet poster
 
Posts: 89
Default Validating Email Address

I want to verify/validate user has input a good email address so I am
checking for the '@' sign and a period in the email string. Is there a
better way? The two iif statements work fine separately but when I combine
them with an 'OR' clause I am missing a parenthesis or comma somewhere - can
you give me a clue?
dblchk:
iIf(or(InStr([EMPLOYEE_EMAIL_ADDRESS],".")=0,IIf(InStr([EMPLOYEE_EMAIL_ADDRESS],"@"))=0,"checkemail",""))

Thanks
Steve
  #2  
Old December 31st, 2009, 05:37 AM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Validating Email Address

On Wed, 30 Dec 2009 19:17:01 -0800, Steve Stad
wrote:

I want to verify/validate user has input a good email address so I am
checking for the '@' sign and a period in the email string. Is there a
better way? The two iif statements work fine separately but when I combine
them with an 'OR' clause I am missing a parenthesis or comma somewhere - can
you give me a clue?
dblchk:
iIf(or(InStr([EMPLOYEE_EMAIL_ADDRESS],".")=0,IIf(InStr([EMPLOYEE_EMAIL_ADDRESS],"@"))=0,"checkemail",""))

Thanks
Steve


Unlike Excel, which has an OR() function, Access uses OR as an operator - very
much like + for addition or - for subtraction. Try

IIf(InStr([EMPLOYEE_EMAIL_ADDRESS],".")=0 OR
InStr([EMPLOYEE_EMAIL_ADDRESS],"@")=0,"checkemail","")

This of course does not guarantee a valid address but it should winnow a lot
of the problems.
--

John W. Vinson [MVP]
  #3  
Old December 31st, 2009, 05:40 AM posted to microsoft.public.access.queries
Allen Browne
external usenet poster
 
Posts: 11,706
Default Validating Email Address

How about adding a validation rule on the field in table design?

Something along these lines:
Is Null OR ((Like "*?@?*.?*") AND (Not Like "*[ ,;]*"))

That example requires at least one character, @, at least one character,
dot, at least one character. Space, comma, and semicolon are not permitted.

--
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.


"Steve Stad" wrote in message
...
I want to verify/validate user has input a good email address so I am
checking for the '@' sign and a period in the email string. Is there a
better way? The two iif statements work fine separately but when I
combine
them with an 'OR' clause I am missing a parenthesis or comma somewhere -
can
you give me a clue?
dblchk:
iIf(or(InStr([EMPLOYEE_EMAIL_ADDRESS],".")=0,IIf(InStr([EMPLOYEE_EMAIL_ADDRESS],"@"))=0,"checkemail",""))

Thanks
Steve


  #4  
Old December 31st, 2009, 02:51 PM posted to microsoft.public.access.queries
Dale Fye
external usenet poster
 
Posts: 2,651
Default Validating Email Address

if you really want to validate the email, you need to send an email and then
use automation to check your mailbox for rejects.

----
HTH
Dale



"Steve Stad" wrote:

I want to verify/validate user has input a good email address so I am
checking for the '@' sign and a period in the email string. Is there a
better way? The two iif statements work fine separately but when I combine
them with an 'OR' clause I am missing a parenthesis or comma somewhere - can
you give me a clue?
dblchk:
iIf(or(InStr([EMPLOYEE_EMAIL_ADDRESS],".")=0,IIf(InStr([EMPLOYEE_EMAIL_ADDRESS],"@"))=0,"checkemail",""))

Thanks
Steve

  #5  
Old December 31st, 2009, 03:25 PM posted to microsoft.public.access.queries
Steve Stad
external usenet poster
 
Posts: 89
Default Validating Email Address

Thanks John/Allen/Dale,

All your advise was great. I think validating in the table desing mode is
most effecient.

"Allen Browne" wrote:

How about adding a validation rule on the field in table design?

Something along these lines:
Is Null OR ((Like "*?@?*.?*") AND (Not Like "*[ ,;]*"))

That example requires at least one character, @, at least one character,
dot, at least one character. Space, comma, and semicolon are not permitted.

--
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.


"Steve Stad" wrote in message
...
I want to verify/validate user has input a good email address so I am
checking for the '@' sign and a period in the email string. Is there a
better way? The two iif statements work fine separately but when I
combine
them with an 'OR' clause I am missing a parenthesis or comma somewhere -
can
you give me a clue?
dblchk:
iIf(or(InStr([EMPLOYEE_EMAIL_ADDRESS],".")=0,IIf(InStr([EMPLOYEE_EMAIL_ADDRESS],"@"))=0,"checkemail",""))

Thanks
Steve


.

  #6  
Old December 31st, 2009, 06:00 PM posted to microsoft.public.access.queries
Dale Fye
external usenet poster
 
Posts: 2,651
Default Validating Email Address

I don't disagree, but until you actually send an email to the address, you
have only validated the appearance of the email address, not that the
address actually works or is the email assigned to the person who is
accessing it. Actually, my method doesn't actually validate that the email
address provided belongs to the person, only that it is not rejected by the
email servers.

Why do you think so many web sites send you a validation email, with a
hyperlink that takes you back to another page on their site?

Dale

"Steve Stad" wrote in message
...
Thanks John/Allen/Dale,

All your advise was great. I think validating in the table desing mode is
most effecient.

"Allen Browne" wrote:

How about adding a validation rule on the field in table design?

Something along these lines:
Is Null OR ((Like "*?@?*.?*") AND (Not Like "*[ ,;]*"))

That example requires at least one character, @, at least one character,
dot, at least one character. Space, comma, and semicolon are not
permitted.

--
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.


"Steve Stad" wrote in message
...
I want to verify/validate user has input a good email address so I am
checking for the '@' sign and a period in the email string. Is there a
better way? The two iif statements work fine separately but when I
combine
them with an 'OR' clause I am missing a parenthesis or comma
somewhere -
can
you give me a clue?
dblchk:
iIf(or(InStr([EMPLOYEE_EMAIL_ADDRESS],".")=0,IIf(InStr([EMPLOYEE_EMAIL_ADDRESS],"@"))=0,"checkemail",""))

Thanks
Steve


.



 




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 09:45 AM.


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