Getting tasks from access

J

John Wright

I want to import a table from access into outlook's task folder. I have a
sales group of people that need to retrieve items from this database and add
it to their tasks. I would like this to be automated to kick off every two
hours. Can this be done? Does anyone have any code as an example for
this? I am an experienced VB programmer (.net and classic) but have done
very little programming in Outlook itself. The program needs to be
contained within Outlook. Any code, or examples would be great.

John Wright
 
E

Eric Legault [MVP - Outlook]

The only way to automate this on a schedule would be to create a series of
recurring tasks - one for each 2 hour block. Then you can trap the Task and
see if it's your scheduled import task (for example, use the Subject line or
Category to differentiate them from other tasks):

Dim WithEvents myolapp As Outlook.Application

Sub Initialize_handler()
Set myolapp = CreateObject("Outlook.Application")
End Sub

Private Sub myolapp_Reminder(ByVal Item As Object)
Item.Display
'Or do something else - i.e. call a database import proc
End Sub

Once you've validated that this a reminder for the task you want, fire up
your query to return the records from the database. Then use
Application.CreateItem(olTaskItem) to return a new TaskItem object for each
record, setting the object's properties from the data before you save it to
the default Tasks folders (which is where the Task will be saved unless you
want it in another folder - then you'd use MAPIFolder.Items.Add("IPM.Task").

See here for more info:

Connecting Outlook to Databases:
http://www.outlookcode.com/article.aspx?ID=25
 

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