Solved

Validating an e-mail address

Posted on 2001-06-04
6
166 Views
Last Modified: 2012-05-04
Hi,

I was wondering if anyone has any quick routines on validating e-mail addresses in VB, ie., checking there is one @, at least one '.', no spaces etc.

Any help would be greatly appreciated.

Ben
0
Comment
Question by:Bennie
6 Comments
 
LVL 1

Expert Comment

by:vim_asteya
ID: 6155206
u can use the instr function.
I did the validation using this function
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 6155208
If strEmail like "*@*.*" and Instr(1,strEmail," ") = 0 Then
  'email seems valid
End If

0
 
LVL 1

Expert Comment

by:vim_asteya
ID: 6155211
Dim v1, v2
If Len(email.Text) = 0 Then
    DoEvents
ElseIf Len(email.Text) > 0 Then
    v2 = (InStr(1, email.Text, "@", vbTextCompare))
    v1 = (InStr(1, email.Text, ".", vbTextCompare))
       
        If ((v2 > 0) And (v1 > 0)) Then
            DoEvents
        Else
            MsgBox "Invalid ID", , "Email"
            email.SetFocus
            email.Text = ""
        End If
End If
try this,it worked for me
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Accepted Solution

by:
Ninibini earned 70 total points
ID: 6155217
check out
http://161.58.186.98/misc/tip519.html
at vb-world.net
the have a sample posted on their site.

0
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 6155241
0
 

Author Comment

by:Bennie
ID: 6155257
Thanks very much everyone for suggestions. This one seems to have worked out the best.

Ben
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now