Results 1 to 13 of 13
  1. #1
    donillo is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    7

    Outlook

    Hi, I am having issues with an access db I use to assign tasks in outlook. Before we updated to office 2010 from 2007 (I think), it worked fine. After the update, it produces an error "application-defined or object-defined error". The problem line is this:



    Set myDelegate = myItem.Recipients.Add(rs("Email"))

    It won't insert the TO email address.
    I have a workaround with "on error next" so that the email comes up and I enter the email address.

    Here is the code: Sorry no line numbers.

    Dim myOlApp As New Outlook.Application

    Dim myItem As Outlook.TaskItem

    Dim myDelegate As Outlook.Recipient

    Dim rs As DAO.Recordset



    Set myOlApp = CreateObject("Outlook.Application")

    Set myItem = myOlApp.CreateItem(olTaskItem)

    Set rs = CurrentDb.OpenRecordset("qselSendEmailNotification ")

    Set rsIssueID = rs("IssueID")

    Set rsIssueRequesterNameTxt = rs("IssueRequesterNameTxt")

    Set rsRequestingOfficeTxt = rs("PAY_OFFICE_NAME")

    Set rsIssueDescSumMem = rs("IssueDescSumMem")

    Set rsFilePathTxt = rs("FilePathTxt")

    Set rsDueDate = rs("Due Date")

    Set rsEmail = rs("Email")

    Set rsCCEmail = rs("CCEmail")

    myItem.Assign

    Set myDelegate = myItem.Recipients.Add(rs("Email"))

    myDelegate.Resolve

    If myDelegate.Resolved Then

    myItem.Subject = "Task # " & rsIssueID & ": " & rsIssueDescSumMem

    myItem.Body = "Please view the FNIP Inquiry Tracking Log Database for more information regarding the assigned task." & _

    vbCrLf & "File Path:" & " " & "S:\FNIP\FNIP Management and Administration\FNIP Tracking Log\FNIP Tracking Log Production" & _

    vbCrLf & vbCrLf & "Task #:" & " " & rsIssueID & vbCrLf & "Requestor Name:" & " " & rsIssueRequesterNameTxt & _

    vbCrLf & "Requesting Office:" & " " & rsRequestingOfficeTxt & vbCrLf & "Issue Summary:" & " " & rsIssueDescSumMem

    myItem.DueDate = rsDueDate

    myItem.ReminderTime = DateAdd("d", 1, Now)

    myItem.Importance = olImportanceNormal

    myItem.Display

    myItem.Assign

    End If

    Set rs = Nothing

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    Did you change the Outlook library reference in VBA for the new version?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    donillo is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    7
    Quote Originally Posted by June7 View Post
    Did you change the Outlook library reference in VBA for the new version?

    Hmm, I'll check it out.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    I meant on the VBA editor menu: Tools > References
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    donillo is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    7
    The only thing I see that may be relevant is :"Microsoft 14.0 Object Library" which is checked in both Outlook and Access

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Maybe you can do some testing with a literal value.
    'Set myDelegate = myItem.Recipients.Add(rs("Email"))
    Set myDelegate = myItem.Recipients.Add("Joe Blow")

  7. #7
    donillo is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    7
    Quote Originally Posted by ItsMe View Post
    Maybe you can do some testing with a literal value.
    'Set myDelegate = myItem.Recipients.Add(rs("Email"))
    Set myDelegate = myItem.Recipients.Add("Joe Blow")

    That didn't work; got the same error.

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by donillo View Post
    ...It won't insert the TO email address.
    I have a workaround with "on error next" so that the email comes up and I enter the email address...
    What is the purpose of this Dimension?
    Dim myDelegate As Outlook.Recipient

    What do you expect Outlook to do with it?

    What happens when you comment out all of your error trapping?

  9. #9
    donillo is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    7
    Quote Originally Posted by ItsMe View Post
    What is the purpose of this Dimension?
    Dim myDelegate As Outlook.Recipient

    What do you expect Outlook to do with it?

    What happens when you comment out all of your error trapping?


    The purpose is to define the email addressee, I think. This code was written some years ago; it was there before my time. I had bypass the "set mydelegate" line with "on error resume next" . This works but the TO FIELD is left blank so i have to enter the email address.

  10. #10
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I copied your code and changed the query to a temp table I created. The following worked. Although, it only grabbed the first record from the table.

    Code:
     
    Dim myOlApp As New Outlook.Application
    Dim myItem As Outlook.TaskItem
    Dim myDelegate As Outlook.Recipient
    Dim rs As DAO.Recordset
     
    Set myOlApp = CreateObject("Outlook.Application")
    Set myItem = myOlApp.CreateItem(olTaskItem)
    Set rs = CurrentDb.OpenRecordset("TableOne")
    Set rsIssueID = rs("IssueID")
    Set rsIssueRequesterNameTxt = rs("IssueRequesterNameTxt")
    Set rsRequestingOfficeTxt = rs("PAY_OFFICE_NAME")
    Set rsIssueDescSumMem = rs("IssueDescSumMem")
    Set rsFilePathTxt = rs("FilePathTxt")
    Set rsDueDate = rs("Due Date")
    Set rsEmail = rs("Email")
    Set rsCCEmail = rs("CCEmail")
    myItem.Assign
    Set myDelegate = myItem.Recipients.Add(rs("Email"))
    myDelegate.Resolve
    If myDelegate.Resolved Then
    myItem.Subject = "Task # " '& rsIssueID & ": " & rsIssueDescSumMem
    ' myItem.Body = "Please view the FNIP Inquiry Tracking Log Database for more information regarding the assigned task." & _
    '
    ' vbCrLf & "File Path:" & " " & "S:\FNIP\FNIP Management and Administration\FNIP Tracking Log\FNIP Tracking Log Production" & _
    '
    ' vbCrLf & vbCrLf & "Task #:" & " " & rsIssueID & vbCrLf & "Requestor Name:" & " " & rsIssueRequesterNameTxt & _
    '
    ' vbCrLf & "Requesting Office:" & " " & rsRequestingOfficeTxt & vbCrLf & "Issue Summary:" & " " & rsIssueDescSumMem
    myItem.DueDate = rsDueDate
    myItem.ReminderTime = DateAdd("d", 1, Now)
    myItem.Importance = olImportanceNormal
    myItem.Display
    myItem.Assign
    End If
    Set rs = Nothing

  11. #11
    donillo is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    7
    Quote Originally Posted by ItsMe View Post
    I copied your code and changed the query to a temp table I created. The following worked. Although, it only grabbed the first record from the table.

    Code:
     
    Dim myOlApp As New Outlook.Application
    Dim myItem As Outlook.TaskItem
    Dim myDelegate As Outlook.Recipient
    Dim rs As DAO.Recordset
     
    Set myOlApp = CreateObject("Outlook.Application")
    Set myItem = myOlApp.CreateItem(olTaskItem)
    Set rs = CurrentDb.OpenRecordset("TableOne")
    Set rsIssueID = rs("IssueID")
    Set rsIssueRequesterNameTxt = rs("IssueRequesterNameTxt")
    Set rsRequestingOfficeTxt = rs("PAY_OFFICE_NAME")
    Set rsIssueDescSumMem = rs("IssueDescSumMem")
    Set rsFilePathTxt = rs("FilePathTxt")
    Set rsDueDate = rs("Due Date")
    Set rsEmail = rs("Email")
    Set rsCCEmail = rs("CCEmail")
    myItem.Assign
    Set myDelegate = myItem.Recipients.Add(rs("Email"))
    myDelegate.Resolve
    If myDelegate.Resolved Then
    myItem.Subject = "Task # " '& rsIssueID & ": " & rsIssueDescSumMem
    ' myItem.Body = "Please view the FNIP Inquiry Tracking Log Database for more information regarding the assigned task." & _
    '
    ' vbCrLf & "File Path:" & " " & "S:\FNIP\FNIP Management and Administration\FNIP Tracking Log\FNIP Tracking Log Production" & _
    '
    ' vbCrLf & vbCrLf & "Task #:" & " " & rsIssueID & vbCrLf & "Requestor Name:" & " " & rsIssueRequesterNameTxt & _
    '
    ' vbCrLf & "Requesting Office:" & " " & rsRequestingOfficeTxt & vbCrLf & "Issue Summary:" & " " & rsIssueDescSumMem
    myItem.DueDate = rsDueDate
    myItem.ReminderTime = DateAdd("d", 1, Now)
    myItem.Importance = olImportanceNormal
    myItem.Display
    myItem.Assign
    End If
    Set rs = Nothing

    Thanks I'll give that a try

  12. #12
    donillo is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    7
    It seems Outlook has some security that trips the error. I can't override it since I'm not a network administrator. Something about not allowing automated emails. So I have to bypass the mydelegate myitem recipients add line and when task comes up, enter the recipient.

  13. #13
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Interesting, thanks for posting this information.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 11
    Last Post: 05-20-2014, 11:32 AM
  2. Outlook and VBA
    By Ruegen in forum Programming
    Replies: 18
    Last Post: 03-12-2014, 11:20 PM
  3. Assigning Outlook task from shared Outlook mailbox
    By Remster in forum Programming
    Replies: 2
    Last Post: 11-16-2011, 04:38 AM
  4. Outlook
    By andysmith652 in forum Access
    Replies: 5
    Last Post: 10-01-2010, 06:31 AM
  5. Outlook
    By noidea in forum Access
    Replies: 0
    Last Post: 08-01-2009, 08:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums