Access Email Input mask.

J

John Vinson

Hey,
Please can I get the format of an input mask that would validate email
addresses in a Access table?thanks

No, you cannot; input masks are much too inflexible to handle the vast
variety of valid EMail addresses.

You'll need to use VBA code in the BeforeUpdate event of the form
textbox - and if you're trying to do it in a table datasheet, I cannot
think of any good way to do it (since table datasheets don't have
programmable events).

John W. Vinson[MVP]
(no longer chatting for now)
 
E

Emeka Nwosu

Thanks.Any means by which I can prevent people adding invalid characters is
good with me.Could you possibly help out with a few lines of code for the
BeforeUpdate event?
 
J

John Vinson

Thanks.Any means by which I can prevent people adding invalid characters is
good with me.Could you possibly help out with a few lines of code for the
BeforeUpdate event?

Sure. Try something like:

Private Sub txtEmail_BeforeUpdate(Cancel as Integer)
If Me!txtEmail Like "*[ !$%^&*()]*" Then
MsgBox "Invalid characters in EMail address", vbOKOnly
Cancel = True
End If
If Me!txtEmail Not Like "*@*.*" Then
MsgBox "EMail should be in the format (e-mail address removed)", vbOKOnly
Cancel = True
End If
End Sub

Use a verified (rather than my guess!) list of invalid characters
inside the brackets in the first IF.

John W. Vinson[MVP]
(no longer chatting for now)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top