Sending reports in an email

G

Guest

I need help. I am new to access. I have a report that I gereate every quater.
This report has information on for several people. I can send this report to
all the people as one report. I want to have this report seperated by person
and then sent to that person. Can this be done? Can soneone help me with
this. The report name is Supplier report.

Thanks,
Ron
 
D

David Lloyd

Ron:

One alternative is to use the WHERE parameter of the OpenReport method to
filter your report for each person. You can then use the SendObject method
to send a copy of the report to that person. By using a loop you can
iterate through each person and send them an individual report. The
following example assumes you are using a field called LastName to
distinguish between people, and that their email address is in a field
called Email in the same table. It sends the report in snapshot format,
however, other formats are available.

Function SendReports()
Dim rs As DAO.Recordset

Set rs = CurrentDb.OpenRecordset("SELECT LastName, Email FROM MyTable;")

Do Until rs.EOF
DoCmd.OpenReport "MyReport", acViewPreview, , "LastName='" &
rs("LastName") & "'"
DoCmd.SendObject acSendReport, "", acFormatSNP, rs("Email"), , ,
"Quarterly Report for " & rs("LastName"), "Some Text", False
DoCmd.Close acReport, "MyReport", acSaveNo
rs.MoveNext
Loop

Set rs = Nothing

End Function


--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


I need help. I am new to access. I have a report that I gereate every
quater.
This report has information on for several people. I can send this report to
all the people as one report. I want to have this report seperated by person
and then sent to that person. Can this be done? Can soneone help me with
this. The report name is Supplier report.

Thanks,
Ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top