Validation rule for email field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to have a validation rule that enforces the use of "@" for the "email"
field of a table.
How is the validaton rule created? I am not very proficient in code, and
relativelly new to Access, but I have checked the Expression Builder and I
could not find an expression that will allow typing and undefinite amount of
caracters before and after the '@" symbol.
I will appreciate if someone could give me an indication of how this is
written.

Thank you for your help!
Rocio
 
Hi Rocio,

you can do something like this:

ValidationRule -->
Like "*@*"
And Left([email_fieldname],1)<>"@"
And Right([email_fieldname],1)<>"@"

ValidationText --> you have to use @ in the middle of your email address

this will check to make sure (if email address is filled out)
1. @ is there
2. @ is not the first character
3. @ is not the last character

Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote programming and Training
strive4peace2006 at yahoo.com
*
 
Rocio, if you did want to use a Validation Rule on the field in the table,
you could try something like this:

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

That requires at least 1 character, @, at least one character, dot, at least
one character.

Put any illegal characters inside the square brackets.
 
thanks, Allen!

I knew there must be an easier way...


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote programming and Training
strive4peace2006 at yahoo.com
*
 
Thank You Allen and Peacefull Crystal, you have provided me with the answer
and pointed me in the right direction. Thanks again and have a good weekend!
Regards,
Rocio

strive4peace said:
thanks, Allen!

I knew there must be an easier way...


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote programming and Training
strive4peace2006 at yahoo.com
*



Allen said:
Rocio, if you did want to use a Validation Rule on the field in the table,
you could try something like this:

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

That requires at least 1 character, @, at least one character, dot, at least
one character.

Put any illegal characters inside the square brackets.
 
you too, Rocio! happy to help ;)

Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote programming and Training
strive4peace2006 at yahoo.com
*



Rocio_LB said:
Thank You Allen and Peacefull Crystal, you have provided me with the answer
and pointed me in the right direction. Thanks again and have a good weekend!
Regards,
Rocio

strive4peace said:
thanks, Allen!

I knew there must be an easier way...


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote programming and Training
strive4peace2006 at yahoo.com
*



Allen said:
Rocio, if you did want to use a Validation Rule on the field in the table,
you could try something like this:

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

That requires at least 1 character, @, at least one character, dot, at least
one character.

Put any illegal characters inside the square brackets.
 
Allen said:
Is Null Or ((Like "*?@?*.?*") And (Not Like "*[ ,;]*"))

Rather than multiple rules within the same (long) validation rule, each
simple rule can be tested in a single CHECK constraint (note your test
for null would be redundant). This allows for a more realistic attempt
at validating an email e.g. yours does not fail the value 'a@[email protected]'.

Jamie,

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top