Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send a customized report to each user in a table

Status
Not open for further replies.

jett88

Programmer
Apr 18, 2002
7
US
I am in the process of trying to write a script that will send an individualized report daily to each user within a table.

Employees Table
EmployeeID - Key
Ext - Unique value but contains blanks
Email - Email address

What I am trying to do is to run a report daily for each Ext that shows the previous days stats and then emails that report to them. What I need help with is writing the script that runs the report for each Ext number.

My report currently uses the Ext value on a form to generate the report for that Ext.
 
lets say your report runs on a query called dailyreportqry
the sql is select.....where ext=forms!myform!txtext in the the on click event
DoCmd.SendObject acSendReport, "dailyreport", acFormatSNP, "emailaddress"
change the on click event to
dim mydb as database
set mydb=currentdb
dim rst as recordset
set rst=mydb.openrecordset("select ext from Employees"
do while not rst.eof
mydb.querydefs("dailyreportqry").sql = select.....where ext=" & rst!ext & ";"
DoCmd.SendObject acSendReport, "dailyreport", acFormatSNP, "emailaddress"

loop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top