Update Access table when Outlook contact item is changed

B

Bogdan Zamfir

Hi,

I use Access2000 and Outlook 2000
I have an Access application, which maintains a list of contacts into an
MDB.

When I create a new contact into my app, I have a sub which automatically
create a new ContactItem in Outlook, with the same data as in my MDB. Also,
I set the ContactID property of the Outlook contact to the ID of my Access
contact.

Now I want to be able to let user to edit the contact in Outlook, and
automatically update the contact in my Access MDB.
How can I do this?

I found this code on ng's which executes when a Contact item is opened for
edit in outlook

Public WithEvents colInsp As Inspectors

Private Sub Application_Startup()
Set colInsp = Inspectors
End Sub

Private Sub colInsp_NewInspector(ByVal Inspector As Inspector)
Dim objItem As Object
Set objItem = Inspector.CurrentItem
If objItem.Class = olContact Then
MsgBox "Open item type " & objItem.Class
End if
End Sub

How can I detect now when the contact item was changed and saved?
Also, how can I detect when a new contact item is created or deleted?

Thank you
Bogdan
 
S

Sue Mosher [MVP]

Instead of MsgBox "Open item type " & objItem.Class, you could use objItem to instantiate a ContactItem object that you've declared WithEvents (as colInsp was declared). After you do that, you'll be able to develop a Write event handler (e.g. objContact_write).
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 

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