Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validating an email address

Status
Not open for further replies.

aos

MIS
Feb 28, 2002
20
US
Hi!
i am trying to validate an email address below. Am i going about it the wrong way? It doesn't recognise a correct email address....any ideas?
thanks!


If txtEmail.Text <> &quot;&quot; Then

Dim iX As Long
iX = InStr(1, strAddress, &quot;@&quot;, vbBinaryCompare)
If iX Then If InStr(iX, strAddress, &quot;.&quot;, vbBinaryCompare) Then Checkemail = True

If Checkemail = False Then
MsgBox &quot;Please enter a valid Email Address&quot;, vbExclamation, &quot;Email Address&quot;
End If
Exit Sub
End If
 
I changed your code just a tiny bit and got it to work below is what it was like when I got it to work
Later
G

If txtEmail.Text <> &quot;&quot; Then
strAddress = txtEmail.Text
Dim iX As Long
iX = InStr(1, strAddress, &quot;@&quot;, vbBinaryCompare)
If iX Then
If InStr(iX, strAddress, &quot;.&quot;, vbBinaryCompare) Then
Checkemail = True
End If
End If

If Checkemail = False Then
MsgBox &quot;Please enter a valid Email Address&quot;, vbExclamation, &quot;Email Address&quot;
Else
MsgBox &quot;valid address&quot;, vbExclamation, &quot;Email Address&quot;
End If
Exit Sub
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top