how to use this to query my table?

T

Tom van Stiphout

On Sun, 16 May 2010 18:52:30 -0700 (PDT), Song <[email protected]>
wrote:

Write a public function in a standard module:
Public Function TestEmail(myEmailField as string) as Boolean
Dim pattern As String
pattern = "\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b"
Dim r As RegExp 'Requires a reference to Microsoft VBScript
Regular Expressions 5.5
Set r = New RegExp
r.pattern = pattern
r.IgnoreCase = True
TestEmail = r.test(myEmailField )
set r = nothing
end function

Then call this function from your query:
select *, TestEmail(myEmailField) as IsValidEmail from myTable

-Tom.
Microsoft Access MVP
 

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