Email attachments with reports (1 Viewer)

rainbows

Registered User.
Local time
Today, 04:32
Joined
Apr 21, 2017
Messages
425
Code:
Private Sub cmdEmail_Click()




    Dim strTo As String
    Dim strSubject As String
    Dim strMessageText As String
    
    Me.Dirty = False
     strTo = [Order Details subform].[Form]![EMailaddress]
 
    strSubject = " Acknowledgement Number " & Me.id
    strMessageText = Me.Firstname & "," & _
        vbNewLine & vbNewLine & _
        "Your latest Acknowledgement is attached." & _
        vbNewLine & vbNewLine & _
        ""


    DoCmd.SendObject ObjectType:=acSendReport, _
        ObjectName:="order acknowledgement", _
        OutputFormat:=acFormatPDF, _
        To:=strTo, _
        Subject:=strSubject, _
        messageText:=strMessageText, _
        EditMessage:=True
    

End Sub



This code sends the an e.mail to the customer but i need to send the terms and conditions which is a pdf file with the "order acknowledgement" at this time i have attached the terms and condition file to a table called attachments .

thanks
steve




1675967362358.png
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:32
Joined
Oct 29, 2018
Messages
21,473
Hi Steve,

I think to attach the database attachments into an email, you'll have to extract them first and save them on the hard drive for the email. You can automate this process.
 

rainbows

Registered User.
Local time
Today, 04:32
Joined
Apr 21, 2017
Messages
425
hi

I dont need to have it as an attachment I put it there as I thought that was the only way you could attach it to the e.mail thats was sending the order acknowlegement

Steve
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:32
Joined
Oct 29, 2018
Messages
21,473
hi

I dont need to have it as an attachment I put it there as I thought that was the only way you could attach it to the e.mail thats was sending the order acknowlegement

Steve
Ah okay, so if you know the full path to the file you want to attach, you can use Outlook Automation to create the email and attach the files. You won't be able to use SendObject anymore. Are you using MS Outlook for sending/reading emails?
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:32
Joined
Sep 21, 2011
Messages
14,305
Code:
Private Sub cmdEmail_Click()




    Dim strTo As String
    Dim strSubject As String
    Dim strMessageText As String
  
    Me.Dirty = False
     strTo = [Order Details subform].[Form]![EMailaddress]

    strSubject = " Acknowledgement Number " & Me.id
    strMessageText = Me.Firstname & "," & _
        vbNewLine & vbNewLine & _
        "Your latest Acknowledgement is attached." & _
        vbNewLine & vbNewLine & _
        ""


    DoCmd.SendObject ObjectType:=acSendReport, _
        ObjectName:="order acknowledgement", _
        OutputFormat:=acFormatPDF, _
        To:=strTo, _
        Subject:=strSubject, _
        messageText:=strMessageText, _
        EditMessage:=True
  

End Sub



This code sends the an e.mail to the customer but i need to send the terms and conditions which is a pdf file with the "order acknowledgement" at this time i have attached the terms and condition file to a table called attachments .

thanks
steve




View attachment 106331
Well, that is going to bloat your DB quickly? :(
 

Cronk

Registered User.
Local time
Today, 21:32
Joined
Jul 4, 2013
Messages
2,772
Yes, don't save the PDF file in your DB. Save it as a PDF in a sub folder and if necessary save only the name of the PDF in your DB.
 

Users who are viewing this thread

Top Bottom