Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Automate Report Run and Email Results

Posted on 2004-09-27
6
Medium Priority
?
240 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
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 …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

609 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