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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INPUT MASK EMAIL

Status
Not open for further replies.

hendrikje

MIS
Apr 7, 2002
1
0
0
BE
hello,

Can somebody provide me the input mask of an emailaddress? the input masks i am trying always have a dedicated number of characters before the @ sign. thank you for helping me out
 
I don't think you want an input mask for email? I believe you want to check for a valid email address and to do that you need to check for the @ symbol and once you got that then check for a . .
so something like this would work on the before update event of the email object.

Dim strCheckEmail As String
Dim strCheckPosition As String
Dim varChkEmail As Variant

varChkEmail = Me("txtEmailAddr")
strCheckEmail = IIf(IsNull(varChkEmail), "", varChkEmail)

'*Apply the conditions
If Trim(strCheckEmail) <> &quot;&quot; Then
'* Check to see if we have an @ symbol
strCheckPosition = InStr(1, strCheckEmail, &quot;@&quot;)

'* strCheckPosition returns true if we got an @ symbol
'* if strCheckPosition returns False then display an error
'* message and wait for the correct email.

If strCheckPosition = 0 Then
MsgBox &quot;Invalid E-Mail please check your entry&quot; & vbCrLf _
& &quot;before continuing.&quot;, vbCritical, &quot;Error E-Mail&quot;
Cancel = True
GoTo SubExit

ElseIf strCheckPosition > 0 Then
'*we got an @ symbol now check for a dot
If InStr(strCheckPosition, strCheckEmail, &quot;.&quot;) > 0 Then
Me(&quot;cmdEMail&quot;).Enabled = Not (IsNull(varChkEmail))
Else
MsgBox &quot;Invalid E-Mail please repair or remove&quot; & vbCrLf _
& &quot;your entry before continuing.&quot;, vbCritical, &quot;Error E-Mail&quot;
Cancel = True

End If
End If
End If Life's a journey enjoy the ride...

jazzz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top