Hello all,
I'm struggling to understand how to accomplish this. At first I tried taking what I learned from two different forum posts and make it work, but I wasn't really sure what I was doing, and couldn't get anywhere. So I tried another aproach, and still wasn't able to get this working.
Basically, I have a query that formats data into a list of personnel who are coming due for refresher training. The query is formatted to provide me all the details that I need to create an outlook task, and assign it to the person. I tried creating a button on my form to create a record set of that query, and then create / assign a task to each person based on the values from the recordset.
Please take a look at what I have and let me know where I'm going wrong...
Basically, the compiler stops at "Dim myOlApp As New Outlook.Application" with the error: "Compile error: User-defined type not defined"
Thanks in advance! (And yes!!! I have read the MS Support article, things just haven't clicked yet for me)
I'm struggling to understand how to accomplish this. At first I tried taking what I learned from two different forum posts and make it work, but I wasn't really sure what I was doing, and couldn't get anywhere. So I tried another aproach, and still wasn't able to get this working.
Basically, I have a query that formats data into a list of personnel who are coming due for refresher training. The query is formatted to provide me all the details that I need to create an outlook task, and assign it to the person. I tried creating a button on my form to create a record set of that query, and then create / assign a task to each person based on the values from the recordset.
Please take a look at what I have and let me know where I'm going wrong...
Code:
Private Sub SendTasks_Button_Click()
'Create the recordset and set it to the appropriate query
Dim rst As DAO.Database
Dim rstData As DAO.Recordset
Set rst = CurrentDb
Set rstData = rst.OpenRecordset("SendTasks_qry")
For Each record In rstData
'Create a new Task item to work with
Dim myOlApp As New Outlook.Application
Dim myItem As Outlook.TaskItem
Dim myDelegate As Outlook.Recipient
Set myItem = myOlApp.CreateItem(olTaskItem)
Set myDelegate = myItem.Recipients.Add(rstData!EMAIL)
myItem.Assign
myDelegate.Resolve
If myDelegate.Resolved Then
myItem.Subject = rstData!Subject
myItem.DueDate = rstData!DueDate
myItem.Subject = rstData!Subject
myItem.Importance = rstData!Importance
myItem.Display
myItem.Send
End If
Next record
End Sub
Basically, the compiler stops at "Dim myOlApp As New Outlook.Application" with the error: "Compile error: User-defined type not defined"
Thanks in advance! (And yes!!! I have read the MS Support article, things just haven't clicked yet for me)
Last edited: