Results 1 to 8 of 8

Thread: Email Report

  1. #1
    Join Date
    May 2004
    Posts
    17

    Unanswered: Email Report

    I have a database with a combo box called "Salesman" on a form. When I create a new record, I would like to automatically send an email report to the salesman that is selected in the combo box. Please Help.

  2. #2
    Join Date
    Mar 2004
    Location
    UK
    Posts
    30
    I assumed a couple of things here so let me know if its wrong.

    First that you are using outlook and that you will be sending an access report object based on the same data as the form

    The report is sent as a rich text file.

    On the event in question (maybe after a button click) add the code

    Code:
    DoCmd.SendObject acSendReport, "Report Object Name", acFormatRTF, name of combo box,"CC Email Address if needed","BCC Email if needed","Subject of Email","Message",False
    The false at the end sends the email without you seeing it. if you change it to True you would be able to edit the message before sending it. If you dont need the CC or BCC emails still put the commas in as they define the arguments even if you dont use them

    The MSAccess help file on this is ok, but shout if you need help.

    Hope this helps

  3. #3
    Join Date
    May 2004
    Posts
    17
    That worked. The only problem now is that Access is sending the entire report. Is their a way to send only one record at a time? That recored being the one that is displayed currently on the form.

  4. #4
    Join Date
    Apr 2004
    Posts
    66

    I'm struggling with this too...

    I'm working on this very same issue and have a question to add...

    I see that I can hard code in an email address, but like Jor47, I want to send a piece of the report to a specific person. I have a store and an email for that store, so I'm trying to figure out how to write code to send it to the store and that store's email based on a selection made by the user (ie, the user picks a store, and the report with that store's data only get's sent to that store's email... Can this be done, or only by hardcoding it?

  5. #5
    Join Date
    Mar 2004
    Location
    UK
    Posts
    30
    I have attached a zip file with an example in it. The database is in access 97 as thats all I have available at work so you may need to convert it.

    Its very raw as I only had about 5 minutes to throw something together bu I have commented the code in the form and tried to answer both your questions.

    Hopefully you can apply this to your database systems. There should be a table, form, report and module. Look at them all

    Shout if you need help
    Attached Files Attached Files

  6. #6
    Join Date
    Apr 2004
    Posts
    66

    Talking

    I continue to be overwhelmed by the generosity of the members on this board - thank you so much for putting that together - that's exactly what I needed!!!

  7. #7
    Join Date
    Apr 2004
    Posts
    66
    One quick question...what is Chr(34)?

  8. #8
    Join Date
    May 2004
    Posts
    17
    I aggree with Mommyof4. Everyone is very helpful. Thank you very much.

Posting Permissions

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