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

E-mailing Reports

P: 38
Hello everyone, I have a question and I haven't been able to figure it out. I have a database that has all of our safety issues which has primary field Report# and what I am doing is trying to automatically e-mail a report which I have the Code for that which is
Expand|Select|Wrap|Line Numbers
  1.     DoCmd.SendObject acSendReport, "Investigation Report", "Rich Text Format", , , , "Investigation Report"
  2.     SendKeys "%", no
  3.     SendKeys "A", no
  4.     SendKeys "S", no
Now my question is how do I run a where clause from this if I only want it to e-mail the current Report #. The way they enter the information is by add only so it doesn't show the rest of the report#'s, however it's still e-mailing all of the reports. Can anyone help?

Thank you in advance
Feb 25 '09 #1
Share this Question
Share on Google+
3 Replies


ADezii
Expert 5K+
P: 8,624
@freddie1437
  1. Make sure the Current Record is Saved before attempting to E-Mail the Report.
  2. Set the Record Source of the Report equal to a Query with all the relevant Fields present, plus a Criteria in the Primary Key Field equal to something similar to this expression:
    Expand|Select|Wrap|Line Numbers
    1. =Forms![<Your Form Name>]![<Your primary key Field on the Form>]
  3. This assumes, of course, that you are E-Mailing a Report from the Form from which you just added a New Record.
Feb 25 '09 #2

P: 38
@ADezii
Thank you very much! I appreciate that! I can't believe I didn't think of that. I really appreciate your help!
Feb 25 '09 #3

ADezii
Expert 5K+
P: 8,624
@freddie1437
Glad it worked out for you.
Feb 25 '09 #4

Post your reply

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