valid e-mail validation rule

  • Thread starter Thread starter Alan
  • Start date Start date
A

Alan

Hi,

What is the best (fastest) method of making sure
the .com, .net etc (whatever that part of a URL is called)
is at least in a valid format?

I don't care if the e-mail is genuine, just valid.

I was thinking, another table with a list of valid
URL "end bits" to check against?

Thanks

Alan (new to just about everything)
 
Alan said:
Hi,

What is the best (fastest) method of making sure
the .com, .net etc (whatever that part of a URL is called)
is at least in a valid format?

I don't care if the e-mail is genuine, just valid.

I was thinking, another table with a list of valid
URL "end bits" to check against?

Thanks

Alan (new to just about everything)

The problem with using a list of valid domains (that's the ".com",
".net", etc., portion) is that the list is much bigger than you think --
it contains national domains as well as the ones like .com, .net, .org,
..gov, and .mil -- and it changes over time. I use the little function
below to check for a validly *formatted* address:

'----- start of code -----
Function IsValidEmailAddress(Candidate As String) As Boolean

If Trim(Candidate) Like "?*@[!.]*.[!.]*" Then
If Not Candidate Like "*@*@*" Then
IsValidEmailAddress = True
End If
End If

End Function

'----- end of code -----

Since it's a user-defined function, you can't call it from the
validation of a field in a table, but you can call it from the
BeforeUpdate event of a text box on a form.
 
Back
Top