Results 1 to 8 of 8
  1. #1
    cochi30 is offline Novice
    Windows Vista Access 97
    Join Date
    Jun 2009
    Posts
    8

    generating email from Access

    I'm running access 2010 on an XP Professional desktop. It has been working fine, generating emails until a couple of weeks ago.

    It is erroring on the following line of code:

    Set MyDelegate =
    myitem.recipients.add(rs("email"))

    I inserted the following line to continue:
    On error resume next and with this it generates an email but with no addressee.

    The error is:


    Runtime error '287':
    Application-defined or Object-defined error.
    We are in the process of upgrading to Windows 7, however our unit is still using XP.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    What is MyDelegate?

    Show the entire procedure code for analysis. Want to provide the db? Follow instructions at bottom of my post.
    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
    cochi30 is offline Novice
    Windows Vista Access 97
    Join Date
    Jun 2009
    Posts
    8

    Here is the code

    This line errors out: Set myDelegate = myItem.Recipients.Add(rs("Email"))


    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
    On Error Resume Next
    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

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    What is the error message?

    That line looks good.

    However, you declare and set myItem as olTaskItem instead of olMailItem. That might be an issue.
    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
    cochi30 is offline Novice
    Windows Vista Access 97
    Join Date
    Jun 2009
    Posts
    8
    Error Msg is runtime error '287'
    'Application Defined or Object Defined error'
    It was working fine for years until mid-July. I changed oltaskitem to olmailitem and got same results. Ayway, we want a task to be generated instead of an email. I tried also in windows 7 and it acts the same. Our organization is upgrading to Win 7 shortly, but our office is still on Win XP Pro.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    That error message often caused by missing VBA reference. If it was working, what changed in July?

    It won't work from any computer?

    I have never programmatically generated Outlook task, just email. So just tested code to send task. Does not error on the Recipients line. Code does open Outlook task window but that's as far as I get because won't let me send the task assignment to myself. Point is, I can't replicate your issue which means would have to analyze your db if you want to provide.
    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.

  7. #7
    cochi30 is offline Novice
    Windows Vista Access 97
    Join Date
    Jun 2009
    Posts
    8
    I tried on Win 7 (on another workstation) and it gives the same error. I think since our organization is moving from Win XP to Win 7, they could have done some preparations in the network that may be causing the error. You said the code looked good, and it has been working since 2009. So I think it must be something with Win 7.

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Could IT have installed a new server/software, changed server name? Second thread today with similar issue (IT installed new server, code mapping to S: drive might be invalid). By coincidence you also have S: drive mapping in code. Go to post 20 in https://www.accessforums.net/access/...tml#post133642
    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.

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

Similar Threads

  1. Access generating random numbers
    By dama in forum Forms
    Replies: 1
    Last Post: 02-19-2012, 06:36 PM
  2. Generating emails with email-address in body
    By techexpressinc in forum Programming
    Replies: 1
    Last Post: 08-17-2011, 01:48 PM
  3. Generating Email through Access
    By rsteph49 in forum Access
    Replies: 1
    Last Post: 05-02-2011, 11:31 AM
  4. Replies: 4
    Last Post: 04-13-2011, 10:11 AM
  5. access to email
    By cecrotty in forum Access
    Replies: 4
    Last Post: 02-05-2011, 03:49 PM

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