?
Solved

Automate Report Run and Email Results

Posted on 2004-09-27
6
Medium Priority
?
239 Views
Last Modified: 2007-11-05
I have a report created that I would like to run at a specific time each day and email the report to certain recipients.  I'm told this is possible, but need to know how to set it up.  Thanks!
0
Comment
Question by:johnson00
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 27

Expert Comment

by:jjafferr
ID: 12164384

Have a Form Open, in the Timer, set it so that it checks if the time is what you want , then let it run the Report and Send the email/s

1- Form
Set the timer to say 50000 (50 seconds),
On the On Timer of the Form have the following code:

'Assuming you want to print/email at 10pm
if timer="22:00" then
 docmd.sendobject YourReportName, To, Subject, Body  'Please correct the syntax
endif

in the syntax you can put multiple recipients too, just search for sendobject in Access help,
You can use Outlook too.

jaffer
 
0
 
LVL 27

Expert Comment

by:jjafferr
ID: 12164738
Ok, this is the correct code:

Private Sub Form_Timer()
'Quit the program at 10:30pm if the program is still open
    Dim TheTime As Date
    TheTime = Format(Now(), "hh:mm")

    Select Case TheTime
        Case #10:30:00 PM#
            DoCmd.OutputTo acOutputReport, "YourReportName", acFormatRTF, "c:\YourFile.rtf", False
    Case Else
            'do nothing
    End Select

End Sub

for other options of sending emails, please see
http://www.experts-exchange.com/Databases/MS_Access/Q_20563192.html

jaffer
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 12166746
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 27

Accepted Solution

by:
jjafferr earned 1500 total points
ID: 12167388
I corrected the the timer code, but missed up the sendobject, so here both are corrected:

Private Sub Form_Timer()
'Quit the program at 10:30pm if the program is still open
    Dim TheTime As Date
    TheTime = Format(Now(), "hh:mm")

    Select Case TheTime
        Case #10:30:00 PM#
'Either use SendObject OR any other method from here

            DoCmd.SendObject acSendReport, "YourReportName", acFormatRTF,"Jaffer1@home.com;Jaffer2@home.com","Jaffer3@home.com;Jaffer4@home.com","Jaffer5@home.com;Jaffer6@home.com","This is the Subject","This is the Message",0

    Case Else
            'do nothing
    End Select

End Sub

Note, the following from the above:
TO: Jaffer1@home.com;Jaffer2@home.com
CC: Jaffer3@home.com;Jaffer4@home.com
BCC: Jaffer5@home.com;Jaffer6@home.com

jaffer
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 12167402
I would highly recommend against SendObject as it is rather buggy and has many limitations.
0
 
LVL 27

Expert Comment

by:jjafferr
ID: 12167444
Shane, don't you ever sleep man!

I agree, But I had to post my last post because I messed up in the earlier one.

One more thing to look at is the Outlook security,
if you want to automate the sending automatically at odd times when you are not around the PC,
then you should look at options other than Outlook.

if you want to use Outlook, then I would recommend you using ClickYes form http://www.contextmagic.com/express-clickyes/


jaffer
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question