Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2006
    Posts
    4

    Unanswered: Send Object Question

    I am trying to send a report with a new hire announcement via email. The report contains the email address of the new hire, store manager, and district manager. I would like to set up the function so it automatically puts the store manager as the To:, the district manager as the CC:, and the new hire's name in the subject.

    Here is what I have so far:
    DoCmd.OpenReport "NewHireAnnouncement", acViewPreview, "", "", acNormal
    DoCmd.SendObject acReport, "", "RichTextFormat(*.rtf)", "", "", "", "New Hire Information ()", "Here is the new hire information for your newest employee.", True, ""

    Thanks for any help you can give. I haven't used VBA in a few years and have lost it all.

  2. #2
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    DoCmd.SendObject acReport, "ReportName", "RichTextFormat(*.rtf)", "Store Manager Email", "District Manager Email", "", "New Hire Name", "Here is the new hire information for your newest employee.", True, ""

  3. #3
    Join Date
    Aug 2006
    Posts
    4
    Thanks, but that just puts the words Store Manager Email and District Manager email into the fields for the emails instead of the email addresses. Also just says New Hire Name in the subject.

  4. #4
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    Where are you trying to pull the information from?

  5. #5
    Join Date
    Aug 2006
    Posts
    4
    The NewHireAnnouncement report that is open and I am sending. I tried putting [Reports]![NewHireAnnoucement]![txtStoreEmail] in for the store email address. I also tried declaring a variable and setting it equal to the value of the email address. When I did that it put the name of the variable into the To: field.

    Am I making any sense?

  6. #6
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    Where are you running this code from?

  7. #7
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    Did you remove the quotes from before and after the variable name?

  8. #8
    Join Date
    Aug 2006
    Posts
    4
    I did not remove the quotes before. As soon as I did the variables worked fine for everything. Here is the completed code:

    DoCmd.OpenReport "NewHireAnnouncement", acViewPreview, "", "", acNormal
    DoCmd.SendObject acReport, "", "RichTextFormat(*.rtf)", [Reports]![NewHireAnnouncement]![txtStoreEmail], [Reports]![NewHireAnnouncement]![txtDistrictEmail], "", "New Hire Information - " + [Reports]![NewHireAnnouncement]![txtName], "Here is the new hire information for your newest employee.", True, ""

    Thanks for all your help rouge!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •