S
S Jackson
I found this article: http://www.mvps.org/access/general/gen0017.htm
This is my code (which does not work for the moment):
Private Sub Command18_Click()
On Error GoTo Add_Err
'Exit procedure if Task already added to Outlook
If Me.AddedToOutlook = True Then
MsgBox "Task is already added to Outlook"
'Add Task
Else
Dim objOutlook As Object
Dim objTask As Object
Set objOutlook = CreateObject("Outlook.Application")
Set objTask = objOutlook.CreateItem(olTaskItem)
With objTask
.Subject = Me.CaseName & " / DHS No. " & Me.DHSNo
.DueDate = Me.Date
.Body = Me.Event
.ReminderSet = True
.Save
.Close
End With
'Release the TaskItem object variable
Set objTask = Nothing
End If
'Release the Outlook object variable
Set objOutlook = Nothing
'Set the AddedToOutlook flag, display a message
Me.AddedToOutlook = True
MsgBox "Task Added!"
Exit Sub
Add_Err:
MsgBox "Error" & Err.Number & vbCrLf & Err.Description
Exit Sub
End Sub
Am I understanding the article to state that I need to add: objOutlook.quit
before: Set objOutlook = Nothing ??
Can anyone confirm this? Thanks.
S. Jackson
This is my code (which does not work for the moment):
Private Sub Command18_Click()
On Error GoTo Add_Err
'Exit procedure if Task already added to Outlook
If Me.AddedToOutlook = True Then
MsgBox "Task is already added to Outlook"
'Add Task
Else
Dim objOutlook As Object
Dim objTask As Object
Set objOutlook = CreateObject("Outlook.Application")
Set objTask = objOutlook.CreateItem(olTaskItem)
With objTask
.Subject = Me.CaseName & " / DHS No. " & Me.DHSNo
.DueDate = Me.Date
.Body = Me.Event
.ReminderSet = True
.Save
.Close
End With
'Release the TaskItem object variable
Set objTask = Nothing
End If
'Release the Outlook object variable
Set objOutlook = Nothing
'Set the AddedToOutlook flag, display a message
Me.AddedToOutlook = True
MsgBox "Task Added!"
Exit Sub
Add_Err:
MsgBox "Error" & Err.Number & vbCrLf & Err.Description
Exit Sub
End Sub
Am I understanding the article to state that I need to add: objOutlook.quit
before: Set objOutlook = Nothing ??
Can anyone confirm this? Thanks.
S. Jackson