E-mailing Reports

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • freddie1437
    New Member
    • Aug 2008
    • 38

    E-mailing Reports

    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
    Code:
        DoCmd.SendObject acSendReport, "Investigation Report", "Rich Text Format", , , , "Investigation Report"
        SendKeys "%", no
        SendKeys "A", no
        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
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by freddie1437
    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

    DoCmd.SendObjec t acSendReport, "Investigat ion Report", "Rich Text Format", , , , "Investigat ion Report"
    SendKeys "%", no
    SendKeys "A", no
    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
    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:
      Code:
      =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.

    Comment

    • freddie1437
      New Member
      • Aug 2008
      • 38

      #3
      Originally posted by ADezii
      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:
        Code:
        =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.
      Thank you very much! I appreciate that! I can't believe I didn't think of that. I really appreciate your help!

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        Originally posted by freddie1437
        Thank you very much! I appreciate that! I can't believe I didn't think of that. I really appreciate your help!
        Glad it worked out for you.

        Comment

        Working...