Results 1 to 8 of 8
  1. #1
    breezett93 is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2017
    Posts
    53

    Problem with sending pdf reports to Outlook for email

    I am getting error code 2293 when clicking a button to generate a pdf report and send it to Outlook for email. Researching this code indicated their might be a problem with Outlook Trust, but I don't know how to go about testing that.

    It is definitely not an issue with our database program. I tried older iterations to test if the problem was with new code, and all the old versions (even tried one from 2017) did not work.

    I really do think the issue is with Outlook and not Access. After clicking the button, the a pop up says "creating report reportName blah blah blah". Then Access just closes when running the read only versions. On my machine, I get the error code.

    Anyone else experiencing this?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    are you using:
    docmd.sendto ?

  3. #3
    breezett93 is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2017
    Posts
    53
    Quote Originally Posted by ranman256 View Post
    are you using:
    docmd.sendto ?
    No, I am using docmd.sendobject.

    *Update: So far, the command does work only when Outlook is closed. Seems like the problem is with Outlook for sure.

  4. #4
    Eugene-LS's Avatar
    Eugene-LS is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Dec 2018
    Location
    Murmansk
    Posts
    17
    Quote Originally Posted by breezett93 View Post
    ... After clicking the button, the a pop up says "creating report reportName blah blah blah". Then Access just closes when running the read only versions. On my machine, I get the error code.
    Anyone else experiencing this?
    Publish your code please or (better)example of your application (part of it).
    Otherwise difficult ...

  5. #5
    breezett93 is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2017
    Posts
    53
    Quote Originally Posted by Eugene-LS View Post
    Publish your code please or (better)example of your application (part of it).
    Otherwise difficult ...
    Code:
    Private Sub Email_Click()
    Dim lngPOId As Long
    Dim strVend As String
    Dim vardate As Variant
    Dim strFile As String
    
    
    lngPOId = Me!POId
    strVend = Me!VendId
    vardate = Format(Me!PODt, "mmddyy")
    strFile = strVend & " PO " & vardate & " " & lngPOId
    
    strPOWhere = "[POId]=" & lngPOId
    strFile = "C:\My Documents\" & strFile & ".PDF"
    
    On Error GoTo Err_cmdOpenEmail_Click
    'DoCmd.OutputTo acOutputReport, "PORpt01", acFormatPDF, strFile
    DoCmd.SendObject acSendReport, "POEmailRpt01", acFormatPDF, , , , , , True
    
    
    Exit_command127_Click:
     Exit Sub
    Err_cmdOpenEmail_Click:
     If Err.Number = 2501 Then
     Resume Next
     Else
     MsgBox Err.Description
     Resume Exit_command127_Click
     End If
    
    
    End Sub

  6. #6
    Eugene-LS's Avatar
    Eugene-LS is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Dec 2018
    Location
    Murmansk
    Posts
    17
    breezett93, try :
    Code:
    Private Sub Email_Click()
    '
    '... your description - what's going on ...
    '--------------------------------------------------------------------------
    Dim lngPOId As Long
    Dim strVend As String
    Dim vardate As Variant
    Dim strFile As String, strPOWhere$
    
    Dim sTo$ 'list of recipientts
    Dim sSubject$
    Dim sMessageText$
    On Error GoTo Email_Click_Err
    
    '--------------------------------------------------------------------------
    'Original (uncomment it!):
        'lngPOId = Me!POId
        'strVend = Me!VendId
        'vardate = Format(Me!PODt, "mmddyy")
        
    '--------------------------------------------------------------------------
    'My (for my form data - comment it please):
        lngPOId = Me!txtRecID
        strVend = Me!txtRecIDNO
        vardate = Format(Me!txtTestDateTime, "mmddyy")
        
    'Extra from me ...
        sTo = "xxxxxxxxxxxx@gmail.com" ' to ... 
        sSubject = "Test for breezett93! - 01"
        sMessageText = "Test for breezett93! - 01"
        
        
    'Next ...
        strFile = strVend & " PO " & vardate & " " & lngPOId
    
        strPOWhere = "[POId]=" & lngPOId
    
    'Original code:
        'strFile = "C:\My Documents\" & strFile & ".PDF"
        
    'Other way:
        'May be:  strFile = Environ("USERPROFILE") & "\Documents\" & strFile & ".PDF"
        strFile = Environ("TEMP") & "\" & strFile & ".PDF" ' In TEMP folder ...
    
        'DoCmd.OutputTo acOutputReport, "PORpt01", acFormatPDF, strFile
        'DoCmd.SendObject acSendReport, "POEmailRpt01", acFormatPDF, sTo, , , sSubject, sMessageText, True
        
    'Works! ...
        DoCmd.SendObject acSendReport, "rptTest", acFormatPDF, sTo, , , sSubject, sMessageText, True
    
    
    
    Email_Click_End:
        On Error Resume Next
        Err.Clear
        Exit Sub
    
    Email_Click_Err:
        MsgBox "Error: " & Err.Number & vbCrLf & Err.Description & vbCrLf & _
        "in Sub: Email_Click in module: Form_Test", vbCritical, "Error in Application"
        Err.Clear
        Resume Email_Click_End
    
    End Sub
    Tested, it works ...

  7. #7
    breezett93 is offline Advanced Beginner
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2017
    Posts
    53
    In case you missed my update,

    It works for me as well, but ONLY when Outlook is closed. I've never encountered this before.

  8. #8
    Eugene-LS's Avatar
    Eugene-LS is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Dec 2018
    Location
    Murmansk
    Posts
    17
    Quote Originally Posted by breezett93 View Post
    It works for me as well, but ONLY when Outlook is closed. I've never encountered this before.
    I've just tested with MS Outlook is running - it works!
    Try to reboot - or close all MSO processes (Ctrl+Alt+Del) and again ...

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

Similar Threads

  1. Sending a value from Access to Outlook email
    By George in forum Import/Export Data
    Replies: 8
    Last Post: 09-03-2018, 02:53 AM
  2. Replies: 3
    Last Post: 06-19-2016, 07:46 AM
  3. sending email from outlook
    By darwish in forum Programming
    Replies: 1
    Last Post: 04-16-2014, 07:49 AM
  4. Replies: 1
    Last Post: 05-05-2013, 12:13 PM
  5. Sending email via Outlook (and Exchange2003) from Access2003
    By Larry Elfenbein in forum Programming
    Replies: 0
    Last Post: 11-15-2005, 09:03 PM

Tags for this Thread

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