period in name part of email string causes Find method to fail

  • Thread starter Thread starter L Poppan
  • Start date Start date
L

L Poppan

I'm trying to verify that an email address doesn't exist in a public
contact folder before I create the contact. The following code finds
the email address if it exists unless the email address has a period
in the name. For example, if eMail = (e-mail address removed), it's
found, if eMail = (e-mail address removed), it is not.

filterString = "[Email1Address] = " & eMail
Set objContact = objCorpFolder.Items.Find(filterString)
If Not TypeName(objContact) = "Nothing" Then
Debug.Print "duplicate found"
End If

Why would a period before the "@" sign in the email address make the
find fail? (Other characters, such as "_", work fine.) How do I work
around this?

For the record I'm running Outlook 2003, XP Professional, Exchange
2003, and am using custom forms in the public contacts folder. I've
applied the hot fix for KB833856, but am not currently using
favorites.

Thanks!
 
That is odd, isn't it? I did see one possible problem, though: The string
that you're searchihng for needs to be in quotes:

filterString = "[Email1Address] = " & Chr(34) & eMail & Chr(34)
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
 
Back
Top