email validation

D

deb

I am trying to enter a validation rule on the form called fEmail to my field
called RecipientEmail. I do not want the field to be empty and needs to be
in the correct emeil format ???@???.???

I have in the validation rule...
Not IsNull([RecipientEmail]) Or ((Like "*?@?*.?*") And (Not Like "*[ ,;]*"))

This is not working.
please help
 
N

Noëlla Gabriël

Hi Deb,

I think you use the wrong properties.
To be sure the e-mail is filled in, I would set the "Required" property of
the field to Yes, and to ensure a correct way to fill in, I would use the
"Input Mask" property of the field (just press F1 there to open the Help with
all possibilities).
 
D

deb

Great idea but I tried that

I can't use the required property because I am useing a "not in List" and it
errors out if I have a required field in the recordset.

any other ideas.
--
deb


Noëlla Gabriël said:
Hi Deb,

I think you use the wrong properties.
To be sure the e-mail is filled in, I would set the "Required" property of
the field to Yes, and to ensure a correct way to fill in, I would use the
"Input Mask" property of the field (just press F1 there to open the Help with
all possibilities).
--
Kind regards
Noëlla


deb said:
I am trying to enter a validation rule on the form called fEmail to my field
called RecipientEmail. I do not want the field to be empty and needs to be
in the correct emeil format ???@???.???

I have in the validation rule...
Not IsNull([RecipientEmail]) Or ((Like "*?@?*.?*") And (Not Like "*[ ,;]*"))

This is not working.
please help
 
P

Paul Shapiro

I don't find an input mask helpful for an email address, because the
allowable formats vary too much.

I've used this as the validation rule for email attributes in the table's
field properties when Nulls are allowed:
Is Null or (Like "?*@?*.?*")

Since you don't want nulls, you could change that to:
Is Not Null or (Like "?*@?*.?*")
but that might fail on your blank fields. I think the behavior varied a bit
with different Access versions.

Maybe your original rule should use And instead of Or?:
Is Not Null And Like "*?@?*.?*" And (Not Like "*[ ,;]*")

deb said:
Great idea but I tried that

I can't use the required property because I am useing a "not in List" and
it
errors out if I have a required field in the recordset.

any other ideas.
--
deb


Noëlla Gabriël said:
Hi Deb,

I think you use the wrong properties.
To be sure the e-mail is filled in, I would set the "Required" property
of
the field to Yes, and to ensure a correct way to fill in, I would use the
"Input Mask" property of the field (just press F1 there to open the Help
with
all possibilities).
--
Kind regards
Noëlla


deb said:
I am trying to enter a validation rule on the form called fEmail to my
field
called RecipientEmail. I do not want the field to be empty and needs
to be
in the correct emeil format ???@???.???

I have in the validation rule...
Not IsNull([RecipientEmail]) Or ((Like "*?@?*.?*") And (Not Like "*[
,;]*"))

This is not working.
please help
 
D

deb

This will not work for me. If I put the validation in the table, it errors
within the "not in list".

If I put the validation in the form or in the field after update. it is
ignored unless a change is made to the field data. If the field is changed
in any way the error will then appear.

After using the "Not in list" funtion the email field is blank. I need a
way to make this dirty so it will check the field for validation.
any ideas?
--
deb


Paul Shapiro said:
I don't find an input mask helpful for an email address, because the
allowable formats vary too much.

I've used this as the validation rule for email attributes in the table's
field properties when Nulls are allowed:
Is Null or (Like "?*@?*.?*")

Since you don't want nulls, you could change that to:
Is Not Null or (Like "?*@?*.?*")
but that might fail on your blank fields. I think the behavior varied a bit
with different Access versions.

Maybe your original rule should use And instead of Or?:
Is Not Null And Like "*?@?*.?*" And (Not Like "*[ ,;]*")

deb said:
Great idea but I tried that

I can't use the required property because I am useing a "not in List" and
it
errors out if I have a required field in the recordset.

any other ideas.
--
deb


Noëlla Gabriël said:
Hi Deb,

I think you use the wrong properties.
To be sure the e-mail is filled in, I would set the "Required" property
of
the field to Yes, and to ensure a correct way to fill in, I would use the
"Input Mask" property of the field (just press F1 there to open the Help
with
all possibilities).
--
Kind regards
Noëlla


:



I am trying to enter a validation rule on the form called fEmail to my
field
called RecipientEmail. I do not want the field to be empty and needs
to be
in the correct emeil format ???@???.???

I have in the validation rule...
Not IsNull([RecipientEmail]) Or ((Like "*?@?*.?*") And (Not Like "*[
,;]*"))

This is not working.
please help
 
T

Tony Toews [MVP]

deb said:
I am trying to enter a validation rule on the form called fEmail to my field
called RecipientEmail. I do not want the field to be empty and needs to be
in the correct emeil format ???@???.???

Trouble is what about my email address which is tony at granite dot ab
dot ca. Two dots after the @.

I suspect the only way to do this is to use a function call in the
controls BeforeUpdate event. However I've never coded this so I don't
have an example available.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
P

Paul Shapiro

You can't have a validation rule which requires a value and also allow
Nulls. I think you need to allow nulls in the email field, since you want to
be able to add a new row without an email address. Set Required=No and use
the field validation rule:
Is Null or (Like "?*@?*.?*")
So that allows nulls but prohibits a known invalid address. You can find
more complete validation expressions by searching on the web if you want,
but this is all I bother with.

Now you probably have some other condition under which you want to require
an email address. You can enforce that with a table validation rule, as long
as you have suitable logic. A field validation rule can only use that
particular field's data, but a table validation rule can use all the data
fields in the row. For example, if the only data you enter from your Not In
List function is the last name and first name, you could have a table
validation rule that says either all the other fields in the table are Null,
or the email is Not Null. That way anytime someone edits the row and adds
any data beyond the first and last names, the email will be required.

You can also do more with the Not In List function than just add the new row
automatically. You could open the Person form in dialog mode, pre-fill the
first and last names, and require the user to enter whatever data is
required before allowing them to save the row.

deb said:
This will not work for me. If I put the validation in the table, it
errors
within the "not in list".

If I put the validation in the form or in the field after update. it is
ignored unless a change is made to the field data. If the field is
changed
in any way the error will then appear.

After using the "Not in list" funtion the email field is blank. I need a
way to make this dirty so it will check the field for validation.
any ideas?
--
deb


Paul Shapiro said:
I don't find an input mask helpful for an email address, because the
allowable formats vary too much.

I've used this as the validation rule for email attributes in the table's
field properties when Nulls are allowed:
Is Null or (Like "?*@?*.?*")

Since you don't want nulls, you could change that to:
Is Not Null or (Like "?*@?*.?*")
but that might fail on your blank fields. I think the behavior varied a
bit
with different Access versions.

Maybe your original rule should use And instead of Or?:
Is Not Null And Like "*?@?*.?*" And (Not Like "*[ ,;]*")
:



I am trying to enter a validation rule on the form called fEmail to
my
field
called RecipientEmail. I do not want the field to be empty and
needs
to be
in the correct emeil format ???@???.???

I have in the validation rule...
Not IsNull([RecipientEmail]) Or ((Like "*?@?*.?*") And (Not Like "*[
,;]*"))
 

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

Similar Threads


Top