B
Bob Richardson
This seems to be a common problem. I placed the following code in a form
where most users will be entering e-mail addresses. I'm sure it can be
improved on, especially in the area of "invalid characters." But this
approach won't work if data is entered on a datasheet. Is there a way to
code something in the "Validation Rule" area in order to trap these errors?
Private Sub Email_BeforeUpdate(Cancel As Integer)
If Me!EmailAdr Like "*[ !$%^&*()]*" Then
MsgBox "Invalid characters in EMail address", vbOKOnly
Cancel = True
End If
If Not (Me!EmailAdr Like "*@*.*") Then
MsgBox "EMail should be in the format (e-mail address removed)", vbOKOnly
Cancel = True
End If
End Sub
where most users will be entering e-mail addresses. I'm sure it can be
improved on, especially in the area of "invalid characters." But this
approach won't work if data is entered on a datasheet. Is there a way to
code something in the "Validation Rule" area in order to trap these errors?
Private Sub Email_BeforeUpdate(Cancel As Integer)
If Me!EmailAdr Like "*[ !$%^&*()]*" Then
MsgBox "Invalid characters in EMail address", vbOKOnly
Cancel = True
End If
If Not (Me!EmailAdr Like "*@*.*") Then
MsgBox "EMail should be in the format (e-mail address removed)", vbOKOnly
Cancel = True
End If
End Sub