PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Update Access table when Outlook contact item is changed

Reply

Update Access table when Outlook contact item is changed

 
Thread Tools Rate Thread
Old 17-09-2003, 10:09 PM   #1
Bogdan Zamfir
Guest
 
Posts: n/a
Default Update Access table when Outlook contact item is changed


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


  Reply With Quote
Old 06-10-2003, 01:33 PM   #2
Sue Mosher [MVP]
Guest
 
Posts: n/a
Default Re: Update Access table when Outlook contact item is changed

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
http://www.outlookcode.com/jumpstart.aspx


"Bogdan Zamfir" <ams_soft at pcnet dot ro> wrote in message news:%23ZKTuCWfDHA.576@tk2msftngp13.phx.gbl...
> 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
>
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off