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
'*Apply the conditions
If Trim(strCheckEmail) <> "" Then
'* Check to see if we have an @ symbol
strCheckPosition = InStr(1, strCheckEmail, "@"
'* 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 "Invalid E-Mail please check your entry" & vbCrLf _
& "before continuing.", vbCritical, "Error E-Mail"
Cancel = True
GoTo SubExit
ElseIf strCheckPosition > 0 Then
'*we got an @ symbol now check for a dot
If InStr(strCheckPosition, strCheckEmail, "." > 0 Then
Me("cmdEMail".Enabled = Not (IsNull(varChkEmail))
Else
MsgBox "Invalid E-Mail please repair or remove" & vbCrLf _
& "your entry before continuing.", vbCritical, "Error E-Mail"
Cancel = True
End If
End If
End If Life's a journey enjoy the ride...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.