Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking Outlook Tasks to Access

Status
Not open for further replies.

jagnval

Technical User
Feb 19, 2009
10
0
0
US
I am looking for a way to link the outlook tasks folder to outlook for a maintenance database. I was able to create a linked table through the wizard in access 2007 but it only creates start, complete dates and nothing else useful like what the task subject itself. So is there any way to create a linked table so when task is completed or added it can be added to a table in access. I have found this link of "How to programmatically export Outlook items to Access" but i need it conformed to outlook tasks instead of contacts any help would be greatly appreciated. Thank you
 
Here are some notes on changing the linked code. Do not forget that you can also capture events in Outlook and update Access from Outlook.

Code:
' Needs reference to Microsoft Outlook Library
' This code is based in Microsoft Access.

   Dim rst As DAO.Recordset
   Dim ol As New Outlook.Application
   Dim olns As Outlook.NameSpace
   Dim cf As Outlook.MAPIFolder
   Dim c As Outlook.TaskItem
   Dim objItems As Outlook.Items
   Dim Prop As Outlook.UserProperty

   Set rst = CurrentDb.OpenRecordset("tblTasks")

   Set olns = ol.GetNamespace("MAPI")
   Set cf = olns.GetDefaultFolder(olFolderTasks)
   Set objItems = cf.Items
   iTasks = objItems.Count
   If iTasks <> 0 Then
      For i = 1 To iTasks
         If objItems(i).Complete Then
            Set c = objItems(i)
            'Add to Access, you will
            'get a list of possible items from 
            'intellisense 
            rst.AddNew
            rst!DateCompleted = c.DateCompleted
            rst.Update
         End If
      Next i
      rst.Close
      MsgBox "Finished."
   Else
      MsgBox "No tasks to export."
   End If

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top