Re: Emailing report data



Just create a new module, paste this sub there and call it from, say, command button click event of a form

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



"Lateral" <Lateral@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:DD1A7CD1-B179-4C53-9E05-C1948F86BF32@xxxxxxxxxxxxxxxx
Thanks Alex!

What is the best way to implement this?

Regards
Greg

"Alex Dybenko" wrote:

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
>>
>>



.