By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,868 Members | 1,974 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,868 IT Pros & Developers. It's quick & easy.

Send email multiple users using report

P: 3
I was hoping someone can look at this code and tell me what is missing
It works all the way to outlook but once there it is not linking with the emails from the query on the report. It's sending the email to the first person in the table.

Can u tell me why it's not pulling up correct email?
Oct 20 '13 #1
Share this Question
Share on Google+
4 Replies

P: 3
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  4. Private Sub Command5_Click()
  7. Dim strCriteria As String
  8. Dim strDate As String
  9. Dim strEmail As String
  11. strCriteria = "[Date]=" & strDate
  13. DoCmd.OpenReport "R_WeeklyDispatch_Today", acViewPreview, , , acHidden
  14. Dim rs As DAO.Recordset
  15. Set rs = CurrentDb.OpenRecordset("T_Inspectors", dbOpenDynaset) 'We need an email address
  16. rs.MoveFirst
  18. Do While Not rs.EOF 'Loop through every record in T_Inspectors and retreive emails
  20. DoCmd.OpenReport "R_WeeklyDispatch_Today", acViewPreview, , "[Employee]='" & rs![Last Name] & "'"
  22. DoCmd.SendObject acSendReport, "R_WeeklyDispatch_Today", acFormatPDF, strEmail, , , "Current Jobs", "Please contact Tracy with any concerns 415-525-0000", True
  24. rs.MoveNext
  25. DoCmd.Close acReport, "R_WeeklyDispatch_Today"
  26. Loop
  28. rs.Close
  30. Set rs = Nothing
Oct 20 '13 #2

Expert Mod 10K+
P: 12,370
Please use code tags when posting code or formatted data.

You never set your strEmail variable anywhere.
Oct 20 '13 #3

P: 3
I was given the code and do not know how to set the ste email.
Can you assist me?
Oct 20 '13 #4

Expert Mod 10K+
P: 12,370
You set it by using the equal operator.
Expand|Select|Wrap|Line Numbers
  1. strEmail = your change email variable
What that variable is will depend on where you're storing it. You haven't told us that so that's as specific as I can get.
Oct 21 '13 #5

Post your reply

Sign in to post your reply or Sign up for a free account.