Bob Dydd <sm*******@hotmail.com> wrote in
news:9f********************************@4ax.com:
Hi Everybody
Is there any way to write a piece of code
something like this:
If Me.txtFrom = Like ""[@*]*""" then
do this
End if
If Me.txtFrom <> Like ""[@*]*""" then
do that
End if
The @ sign is a forbidden symbol
The idea is to trap where a user may not have entered a correct Email
address.
Thanks to all
Smiley Bob
Or, add a reference to Microsoft VB Script Regular Expressions 5.5 (if you
have Win2K or XP, not a problem, otherwise, you need to download the
Windows Scripting Host stuff from Microsoft).
Public Function Find(target As String, source As String) As String
Dim rexp As New RegExp
Dim rxMatches As MatchCollection
Dim rxMatch As Match
rexp.Pattern = target
Set rxMatches = rexp.Execute(source)
For Each rxMatch In rxMatches
Debug.Print rxMatch.Value
Next rxMatch
End Function