Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Old 02-12-2008, 09:50 AM   #1
airforceruss
Newly Registered User
 
Join Date: Aug 2007
Posts: 259
Thanks: 1
Thanked 1 Time in 1 Post
airforceruss is on a distinguished road
Import/Link Outlook Tasks into Access

So I have tried using the Import Wizard to import/link Outlook Tasks into Access, and it works great except for the fact that it doesn't include the Subject or Message of the task making it completely useless.

Does anyone know of a way to read/import/link Outlook 2007 Tasks from within an Access 2007 Database?

__________________
Russ

Pilot by Profession
Web Developer by Second Profession
Access 2010 DB Designer by Luck (More times than not)
airforceruss is offline   Reply With Quote
Old 02-12-2008, 10:45 AM   #2
Moniker
VBA Pro
 
Join Date: Dec 2006
Location: Dallas
Posts: 1,567
Thanks: 0
Thanked 10 Times in 9 Posts
Moniker will become famous soon enough Moniker will become famous soon enough
Instead of the very limited wizard, connect to Outlook directly, and you can pull all the data. Pseudo-coded so you get the idea:

Dim OLApp As Outlook.Application

Set OLApp = New Outlook.Application

Then, through the OLApp object, you can get everything from Outlook that you want. Use IntelliSense to see all the available properties/methods. You may also need another object (not sure as I've never tried to grab tasks out of Outlook, but I know that email is Dim OLMsg As Outlook.MailItem). Note that you'll need to add the MS Outlook Object Library to your references for this to work.
__________________
~Moniker

(If you've been helped by me or anyone else, please add to their reputation by clicking the "scales" icon in the upper-right.)
Moniker is offline   Reply With Quote
Old 02-13-2008, 10:02 AM   #3
airforceruss
Newly Registered User
 
Join Date: Aug 2007
Posts: 259
Thanks: 1
Thanked 1 Time in 1 Post
airforceruss is on a distinguished road
I've got this article here, but I'm really lost on how to implement.

Could you possibly help point me in the right direction. I've got the following code sorted out. I know it's not in the proper order, it's just what I've gotten copied over so far.

Code:
Private Sub Outlook()
Dim appOutlook As Outlook.Application
Dim appNS, appTasks
Dim AppItems As Outlook.Items

Set appOutlook = New Outlook.Application
Set appNS = appOutlook.GetNamespace("MAPI")
Set appTasks = appNS.GetDefaultFolder(olFolderTasks)
Set AppItems = appTasks.Items


ItemCount = AppItems.Count

' set up append query statements for every task

On Error GoTo 0
For i = 1 To ItemCount
  itPerComp = AppItems(i).PercentComplete
  If itPerComp < 100 And _
    AppItems(i).status <> olTaskDeferred Then
    On Error Resume Next
    If (Not IsMissing(CatRequired) And _
      AppItems(i).Categories = CatRequired) Or _
      IsMissing(CatRequired) Then
      On Error GoTo 0
      DoCmd.Echo True, AppItems(i).Subject
      itDateCreated = AppItems(i).CreationTime
      itSubject = AppItems(i).Subject
      itBody = AppItems(i).Body
      itCategory = AppItems(i).Categories
      itImportance = AppItems(i).Importance
    End If
  End If
Next
Set appOutlook = Nothing



Call AddOutlookTasks(User_FX)

itSubject = AppItems(i).Subject
itBody = AppItems(i).Body

With rstTasks
  .AddNew
  !DateCreated = itDateCreated
  !Subject = itSubject
  !Category = itCategory
  !Body = itBody
  !PercentComplete = itPerComp
  !Importance = itImportance
          
' Add the NT/WinXP/Win2000 username
  !SystemUsername = userNameRequired
          
  .Update
End With


End Sub


Sub AddOutlookTasks(userNameRequired As String, _
Optional CatRequired As Variant)
End Sub

Sub DeleteOutLookTasks()
Const outlookTbl = "tblOutlookTasks"
Dim qryStr As String

qryStr = "delete from " & outlookTbl & _
 " OutlookTasks where systemUserName = '" _
 & userNameRequired & "'"
If Not IsMissing(CatRequired) Then
  qryStr = qryStr & " and category = '" & CatRequired & "'"
End If
 
DoCmd.SetWarnings False
DoCmd.RunSQL qryStr
DoCmd.SetWarnings True

End Sub

__________________
Russ

Pilot by Profession
Web Developer by Second Profession
Access 2010 DB Designer by Luck (More times than not)
airforceruss is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Outlook from Access Tsango Modules & VBA 8 05-08-2015 02:53 AM
Sending Emails via Access on Outlook 2000 and Outlook 2002 Hemish Modules & VBA 0 11-22-2007 09:06 AM
Automating Access from Outlook Just1 Modules & VBA 1 02-06-2007 10:41 AM
Access -> Outlook -> Access Milothicus General 2 12-01-2004 09:14 AM
querying outlook via access mrwendal Queries 2 09-25-2004 02:40 PM




All times are GMT -8. The time now is 05:52 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World