--- In [email protected], myhnews <[EMAIL PROTECTED]> wrote: > > I'm currently using this function to send the text of my report via > email. However, it is being attached as an attachment to the email. > Is there a way to just past the data in the email itself, instead as > an attachment? > > Thank you > Joe
Hi Joe, It is possible to post the field details from your report to the body of the email rather than attaching the report as a file. Your woild replace the line : DoCmd.SendObject acSendReport,stDocName,acFormatTXT, "[EMAIL PROTECTED]", , , "Order ID# " & txtorderNo With DoCmd.SendObject , ,acFormatTXT, "[EMAIL PROTECTED]", , , "Order ID# " & txtorderNo, "sample text", -1 For your purposes you can replace "sample text" (the email body) with fields from a query or recordset. e.g. bText = rs.date & Space(5) & rs.Time+Space(5)& rs.Company+Space(5)+ rs.Contact & Space(5) & rs.Phone & Chr(13) & Chr(13)& rs.Type & Space(5) & rs.Category & Chr(13) & Chr (13) & "Thank you for your order." 'Where chr(13) is a carriage return and each rs.<fieldname> is a valid field name in your recordset. DoCmd.SendObject , ,acFormatTXT, "[EMAIL PROTECTED]", , , "Order ID# " & txtorderNo, bText", -1 If you have not worked with recordsets before in VBA code, open the query source for your report "rptExport" and look at and make a note of the field names used, then look at the example in help for recordsets.
