Find outlook contact and update, or add new

Access and Outlook 2003 using Outlook 11.0 Object Library reference

I've spent quite a long time searching for a way to add contacts to outlook programmatically from an access form.  I was successful in adding new contacts with data from the current record on the form.  The problem is, if the contact already exists, it will create a duplicate contact.  What I can't figure out is how to check if the contact exists.  

This is basically what I want to do (the code is not all there but I hope you get the idea):

If the contact exists then

  Dim Update_Contact As Integer
  Update_Contact = MsgBox("Contact Found." & vbCrLf & "Do you want to update the contact information?", vbYesNoCancel)
  Select Case Update_Contact
    Case vbYes
        'open the contact
        'update with contact info from the current record
        'save the contact
        exit sub
    Case vbNo
        'open the contact to view
        exit sub
    Case vbCancel
        exit sub
  End Select


  'add new contact with info from the current record
  'save the contact

End If

I Just need to know how to check if the contact exists, I have the rest of it worked out already.


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I use this bit of code to see if they exist and then if they dont I then add a new one  

  For Each obj In objItems
        If obj.Class = olContact Then
            Set objContact = obj
                If objContact.FirstName = rst.Fields("FirstName") And objContact.LastName = rst.Fields("Surname") Then
                    With objContact
                        .CompanyName = rst.Fields("Company")
                        .FirstName = rst.Fields("FirstName")
                        .LastName = rst.Fields("Surname")
                        .BusinessAddress = rst.Fields("Address") & Chr(13) & rst.Fields("Suburb") & Chr(13) & rst.Fields("City")
                        .Body = rst.Fields("Description")
                        .BusinessFaxNumber = rst.Fields("Fax")
                        .Email1Address = rst.Fields("Email")
                        .MobileTelephoneNumber = rst.Fields("Mobile")
                        .BusinessTelephoneNumber = rst.Fields("Phone")
                        count = count + 1
                        rst.Fields("update") = False  ' this is used fro tracking what has been changed in the database
                    End With
                End If
        End If
    Next obj

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
traigoAuthor Commented:
thanks for the quick response jimcrint.  I will try it first thing in the morning and post back
traigoAuthor Commented:
GREAT! THANKS!  I was able to get it working.

If you are familiar with the calendar object too, keep an eye out, I may be posting with questions on that soon too.

Thanks again,

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.