**Valid E-mail address ** (1 Viewer)

John M

Registered User.
Local time
Today, 03:21
Joined
Nov 20, 2001
Messages
69
Hi All,

Is there anyway to check for the correct format for a valid email address. I think I've seen a solution somewhere using regular expressions but don't seem to be able to see it anymore. I would appreciate it if somebody can point me in the right direction.

Thanks
 

doulostheou

Registered User.
Local time
Yesterday, 21:21
Joined
Feb 8, 2002
Messages
314
You can use the INSTR function to look for a string criteria in the middle of an expression. This will return the position of @ in the email field. If @ is missing the position will be 0.

Code:
If InStr(1, email, "@") = 0 Then
MsgBox "You must enter the @ sign."
End If

You could also use the right function to validate the last four letters were a .com, .net, etc. Just setup a statement to make sure Right(Email,4) is valid for an e-mail address.
 

Users who are viewing this thread

Top Bottom