VBA for MS Access 2010 | Checking for valid email only when an email is entered (1 Viewer)

Avionicx

Banned
Local time
Yesterday, 19:05
Joined
Oct 2, 2011
Messages
2
Hello everyone!

Here is the problem, I have an Access form and a textbox for an e-mail address. The email address is not required, I only want to check for a valid email address when a value or address has been entered into the e-mail filed. Example: If e-mail is not empty or if email field has a value, then check for the follow elements, matched the email address with the required format. If the e-mail field is empty, do not look for anything, move on.

Any ideas?

Avionicx
 

G37Sam

Registered User.
Local time
Today, 06:05
Joined
Apr 23, 2008
Messages
454
He was actually trying to help you, and wanted you to elaborate on what the exact definition of a valid email is

Are you only looking for an @ sign, or does it have to be a .com etc or should access check online servers for email validity?

Your attitude is not one to use if you actually are looking for online help for free
 

ChrisO

Registered User.
Local time
Today, 12:05
Joined
Apr 30, 2003
Messages
3,202
Avionicx.

>>If you don't know what a valid e-mail is, then you are a complete idiot.<<

By the same token; if you do know what a valid e-mail is you wouldn’t be asking the question, unless…

Please try to make your third post compensate for your second... 24 hours.

Chris.
 

ChrisO

Registered User.
Local time
Today, 12:05
Joined
Apr 30, 2003
Messages
3,202
Avionicx.

24 hours + 1 minute, times up.

Banned for failure to comply with a request to withdraw insulting comments.

Chris.
 

LukeChung-FMS

President, FMS Inc
Local time
Yesterday, 22:05
Joined
Nov 20, 2008
Messages
17
Wow, some people are so touchy. We have an algorithm that validates based on requiring an @ symbol not in the first character and appearing only once. Followed by at least one letter, followed by a . and at least one letter.

The minimum length is 5 characters.

Sounds like the guy needs to learn about the NZ function before validation. Could it have been so simple?
 

vbaInet

AWF VIP
Local time
Today, 03:05
Joined
Jan 22, 2010
Messages
26,374
A simple VBScript regex would have done it but he needed to explain what he meant by an invalid and valid e-mail address. Oh, well his loss.

He's no longer allowed on here thanks to Chris :D
 

boblarson

Smeghead
Local time
Yesterday, 19:05
Joined
Jan 12, 2001
Messages
32,059
He's no longer allowed on here thanks to Chris :D

If Chris didn't ban him, I would have.
 

LukeChung-FMS

President, FMS Inc
Local time
Yesterday, 22:05
Joined
Nov 20, 2008
Messages
17
I'm not familiar with that library. Will all recent versions of Windows have that?
 

stopher

AWF VIP
Local time
Today, 03:05
Joined
Feb 1, 2006
Messages
2,395
I'm not familiar with that library. Will all recent versions of Windows have that?

It's been around since Windows XP and I think maybe before.

Take a look at this thread. There's a link in there somewhere that provides all the background to the syntax.

Chris
 

LukeChung-FMS

President, FMS Inc
Local time
Yesterday, 22:05
Joined
Nov 20, 2008
Messages
17
Thanks for the link, but that doesn't seem to perform email validation. Did I miss something?
 

vbaInet

AWF VIP
Local time
Today, 03:05
Joined
Jan 22, 2010
Messages
26,374
Sorry that was for Collections and Dictionary. I meant the Microsoft VBScript Regular Expressions x.x Library. The latest versions and I think it should be available in 2000 or at least 2003.
 

vbaInet

AWF VIP
Local time
Today, 03:05
Joined
Jan 22, 2010
Messages
26,374
Thanks for the link, but that doesn't seem to perform email validation. Did I miss something?
Just like in SQL or VBA you have LIKE which performs pattern matching using a very limited number of operations, in VBScript you create a pattern matching sequence to validate an e-mail address.

I'm sure Chris (aka Stopher) has a link somewhere with an example of how to use VBScript to match UK postcodes for example.
 

Users who are viewing this thread

Top Bottom