I am using Access/Office 2010 on a Windows 7 platform.
What I am trying to do sounds simple: I want to assign an Outlook Task to the individual selected in a form's combo box.
Here is my code that I took from an MSDN site:
Expand|Select|Wrap|Line Numbers
- Sub AssignedTech_AfterUpdate()
- Dim myOlApp As New Outlook.Application
- Dim myItem As Outlook.TaskItem
- Dim myDelegate As Outlook.Recipient
- Set MyItem = myOlApp.CreateItem(olTaskItem)
- MyItem.Assign
- Set myDelegate = MyItem.Recipients.Add("Dan Wilson")
- myDelegate.Resolve
- If myDelegate.Resolved Then
- myItem.Subject = "Prepare Agenda For Meeting"
- myItem.DueDate = Now + 30
- myItem.Display
- myItem.Send
- End If
- End Sub
When I select the intended recipients name, I get a "Run-Time Error "287" Application-Defined or Object-Defined Error"
When I debug the code, the portion in bold is the culprit. I have tried different ways of doing this but it doesn't matter what I do, it code tanks at the Recipients.Add line.
Any suggestions?