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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook Tasks for Different People from Access 1

Status
Not open for further replies.

jscott39

Programmer
Oct 27, 2000
1
US
I've built an Access database that creates specific tasks for specific people in my department. I want these people to be able to receive their tasks through Outlook. The Access database is on a different NT server than the Outlook Exchange Server. How do I make Outlook tasks for different people from Access?
 
First you need to connect the two programs by opening a module and selecting TOOLS, REFERENCES, and then clicking the MS OutLook Objects 8.0 to allow you to call the object in the code then you will need to create the object and assign the tasks something like below:

This code will assign the task for the user and checks the dates so nothing comes up on a weekend. you shoul dbe able to adapt this to what you need....

Dim outobj As Outlook.Application
Dim outAppt As Outlook.TaskItem
Dim outMail As Outlook.MailItem
Dim dte As Date
Dim remindr As Date

dte = DateAdd("d", 5, Date)
remindr = DateAdd("d", 4, Date)
If DatePart("w", dte) = 1 Or DatePart("w", dte) = 7 Then
If DatePart("w", dte) = 1 Then
dte = DateAdd("d", 1, dte)
ElseIf DatePart("w", dte) = 7 Then
dte = DateAdd("d", 2, dte)
End If
End If

If DatePart("w", remindr) = 1 Or DatePart("w", remindr) = 7 Then
If DatePart("w", remindr) = 1 Then
remindr = DateAdd("d", -2, remindr)
ElseIf DatePart("w", remindr) = 7 Then
remindr = DateAdd("d", -1, remindr)
End If
End If

On Error Resume Next
Set outobj = CreateObject("Outlook.Application") 'Add new reminder
Set outAppt = outobj.CreateItem(olTaskItem)
Set outMail = outobj.CreateItem(olMailItem)

With outAppt
.Subject = "Reconciliations due for client " & Me!Label16.Caption
.DueDate = dte
.ReminderTime = remindr
.ReminderSet = True
.Save
End With
With outMail
.To = strAdmini
.CC = Forms!Main!lblMgr.Caption
.Importance = olImportanceHigh
.Subject = "Reconciliations for client " & Me!Label16.Caption
.Body = "Recs are due on " & dte
.Send
End With

Set outobj = Nothing 'release outlook

MsgBox ("Your reconcilications for the client are due on " & dte)
Exit Sub
End Sub



best of luck
Bastien
 
Bastien,
Do you know of a method by which a user can update that task from Access? I have been able to create new tasks, and import all tasks into the dB but have not been able to successfully update one with data from the dB. I have looked at the ActiveInspector Method, GetInspector property and even GetItemFromID. The best I seem to beable to do is creating a new instance of outlook and going to the task folder with the display property. Thanks!
jelwood01
 
I jumped the gun.... I just worked it out:

Dim appOutLook As Outlook.Application
Dim objNameSpace As NameSpace
Dim objfolder As MAPIFolder
Dim stText As String
Dim stMinute As String
stMinute = Text3 * 60 ' convert hours to minutes

Set appOutLook = CreateObject("Outlook.Application")
Set objNameSpace = appOutLook.GetNamespace("MAPI")
Set objfolder = objNameSpace.GetDefaultFolder(olFolderTasks)

With objfolder.Items(stTaskSubject) ' Subject Line needed to find task
stText = .Body & vbNewLine & Text0
.Body = text
.ActualWork = stMinute
.Save
End With

Set appOutLook = Nothing
Set objNameSpace = Nothing
Set objfolder = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top