Email Report question

S

sue gray

I have a multi page report that has employee information on separate pages.
Ex: John Doe, page 1, Jane Doe, Page 2 .. Etc.. I want to be able to email
the page for john doe to john doe, and jane doe to jane doe, with one command
button. I can email the whole report, but can't figure out how to begin to
select individuals. I have done a lot of reading on here, but it's still not
clear. ANy help would be greatly appreciated.
 
A

Alex Dybenko

Hi,
you can do the following:
make a new query "MyQuery" based of your report's recordsource
set report's recordsource to this query

open recordset to loop through employees
for each employee create a query based of your report's recordsource, but
filtered by employee (you can use currentdb.querydefs("myquery").sql=...)
send report to current employee using docmd.sendobject

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
 
S

sue gray

Thanks for the reply. Can you give me more details? I am ok with the first
steps, but don't have any idea how to handle the second paragraph. Thanks.
 
A

Alex Dybenko

Hi,
here some air code, hope it explains my idea:

set rst=currentdb.openrecordset("MyQueryWithEmployees",dbopenforwardonly)
do until rst.eof
currentdb.querydefs("myquery").sql="Select .... From .... Where
EmployeeID=" & rst.EmployeeID
docmd.sendobject acSendReport,"MyReport",,rst!Email
rst.movenext
loop

see OpenRecordset Method in access help for details opening recordset


--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
 
T

Tony Toews [MVP]

sue gray said:
I have a multi page report that has employee information on separate pages.
Ex: John Doe, page 1, Jane Doe, Page 2 .. Etc.. I want to be able to email
the page for john doe to john doe, and jane doe to jane doe, with one command
button. I can email the whole report, but can't figure out how to begin to
select individuals.

For a page on how to print a report for a single record and how to
generate reports to attach to emails see the Emailing reports as
attachments from Microsoft Access page at
http://www.granite.ab.ca/access/email/reportsasattachments.htm


Tony
 

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