Re: Emailing report data



Hi,
should work now, anyway - here it is:
Public Sub olSendRpt(strTo As String, strBody As String, strSubject As String, strReportName As String)
'A procedure to send report in a body of mail message
'Alex Dybenko, http://Alex.Dybenko.com

'Usage: olSendRpt "Send@xxxxxx", "Pls see report below", "My Report", "Report1"


Dim strFileName As String, intFile As Integer, strLine As String, strTemplate As String

strFileName = Environ("Temp") & "\rep_temp.txt"

If Len(Dir(strFileName)) > 0 Then
Kill strFileName
End If
DoCmd.OutputTo acOutputReport, strReportName, acFormatTXT, strFileName

intFile = FreeFile
Open strFileName For Input As #intFile
Do While Not EOF(intFile)
Line Input #intFile, strLine
strTemplate = strTemplate & vbCrLf & strLine
Loop
Close #intFile

DoCmd.SendObject acSendNoObject, "", acFormatTXT, strTo, , , strSubject, strBody & strTemplate

End Sub

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com

"Lateral" <Lateral@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:505A982E-DEBA-490A-95CB-77C0D711FD9A@xxxxxxxxxxxxxxxx
Hi Alex

Thanks for the link but unfortunately it does not work...can you please
check and reissue the link?

Thanks a lot.

Regards
Greg

"Alex Dybenko" wrote:

Hi,
here a sample code:
http://maug.pointltd.com/access/Queries/TipDetail.asp?TipID=71

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com

"Lateral" <Lateral@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:AF41D044-08FB-4F3A-9851-D0D740E0E6A3@xxxxxxxxxxxxxxxx
> Hi guys
>
> I am using the Issue database template from Microsoft and are making > some
> enhancements.
>
> I want to be able to generate an email and have the body of the email
> contain the report data.
>
> I can create attachments ok but I really want to be able to "merge" the
> report into the body of the actual email.
>
> Any help is appreciated.
>
> Regards
> Greg



.



Relevant Pages

  • RE: Sending report as HTML Body of e-mail
    ... against a report that emits 7 pages. ... } Public Sub olSendRpt(strTo As String, strBody As String, strSubject As ... } Dim strFileName As String, intFile As Integer, strLine As String, ...
    (microsoft.public.access.formscoding)
  • RE: Need help with looping through records to email report
    ... Assuming that the report returns all of the records pretaining to this ... and email it to each employee. ... Dim rst As DAO.Recordset ... Dim strAcountStatus As String ...
    (microsoft.public.access.forms)
  • Re: SnapTheReport -- made it generic | example useage
    ... Sub SnapTheReport(pReportName As String, pFilter As String) ... ' pFilter = string to filter report or "" to get all ... Dim mFilename As String ... SetReportFilter pReportName, pFilter ...
    (microsoft.public.access.formscoding)
  • RE: Query form coding
    ... I have tried to include the query when using the wizard to design the report ... Dim strSource As String ... ' Remove Filter ...
    (microsoft.public.access.formscoding)
  • Re: Need help with looping through records to email report
    ... if Reset OR isempty(myUserID) then myUserID = Null ... You don't really need to open the report in preview mode either, ... Dim rst As DAO.Recordset ... Dim strAcountStatus As String ...
    (microsoft.public.access.forms)

Loading