S
S Jackson
Dan:
This is in response to my post below about object libraries (wow, I really
started something there, didn't I?). I am posting up here as I wanted to be
sure you saw this post.
Thanks for your response. I am brand new to VBA for Access and am mostly
working through and learning as I go. I have bought myself a book, but
have not gotten too far yet.
I got the code to use automation from MS Knowledge Base Article 209963.
After working through it and modifying it for my purposes, I think I
understand most of it, but certainly not all of it. Hence, I do not fully
grasp what you advise in your response below about using late binding. I
think I get the general idea: "Don't use object references because not all
users will have the same versions." But, how do I apply the code you gave
me to my code:
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 Outlook.Application
Dim objTask As Outlook.TaskItem
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
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
I am going to go fool with my code and see if I can figure this one out in
the meantime.
Thanks!
S. Jackson
This is in response to my post below about object libraries (wow, I really
started something there, didn't I?). I am posting up here as I wanted to be
sure you saw this post.
Thanks for your response. I am brand new to VBA for Access and am mostly
working through and learning as I go. I have bought myself a book, but
have not gotten too far yet.
I got the code to use automation from MS Knowledge Base Article 209963.
After working through it and modifying it for my purposes, I think I
understand most of it, but certainly not all of it. Hence, I do not fully
grasp what you advise in your response below about using late binding. I
think I get the general idea: "Don't use object references because not all
users will have the same versions." But, how do I apply the code you gave
me to my code:
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 Outlook.Application
Dim objTask As Outlook.TaskItem
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
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
I am going to go fool with my code and see if I can figure this one out in
the meantime.
Thanks!
S. Jackson