Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 10th, 2005, 05:00 AM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default Setting Reports to run automatically in access

I need to get a report to run automatically in access database once a day that will then send the report by e-mail.I have set up the following code which sends a report every 1hour 40 minutes
Sub Form_Load()
    Me.TimerInterval = 600000
End Sub

Sub Form_Timer()
 Dim stDocName As String
    Dim title As String

    title = " Call ID "


If IsNull(Me.Assignments) And IsNull(Me.CallID) <> True Then



DoCmd.SendObject acSendReport, "rptgpo1", acFormatTXT, "[email protected]", "", "", "Reports", "Hi here are the reports", False


End If
End Sub
Thanks

Brendan Bartley


__________________
Brendan Bartley
 
Old June 10th, 2005, 05:09 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Check this thread which shuts a database at specific time. You can just change the docmd. to run a report instead.

http://p2p.wrox.com/topic.asp?TOPIC_ID=25910

Jon

 
Old June 10th, 2005, 11:07 PM
Authorized User
 
Join Date: Dec 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Brendan Bartley
 ....get a report to run automatically in access database once a day.....
Option Compare Database
Option Explicit
' This code will run your report once a day, every day,
' at the specified time.
' Of cource, MSAccess and the form must remain open
' for the code to work 24/7.
'
Dim ReportRunDate As Date
' ReportRunDate will remember if your report has already been called today.
'
' In form properties, set can set timer interval to several seconds, no hurry.


Private Sub Form_Timer()
  CheckMyScheduler
End Sub


Sub CheckMyScheduler()
  Dim Ev1 As Integer

  Ev1 = 21 ' set the hour at which the event should occur.

  ' has report already run today?
  If Day(ReportRunDate) = Day(Now()) Then Exit Sub

  If Hour(Now()) >= Ev1 Then
     RunMyReport
     End If
End Sub
'

Sub RunMyReport()
  Beep ' insert code here to execute the report.
  ReportRunDate = Now()
  MsgBox "The report has done been runned"
End Sub







Similar Threads
Thread Thread Starter Forum Replies Last Post
run a program automatically hastikeyvan ASP.NET 2.0 Professional 1 December 18th, 2009 03:34 PM
making application run automatically liamfitz Pro VB 6 4 January 23rd, 2008 05:27 PM
run automatically...help plz lom2pac Access 2 August 7th, 2006 10:42 AM
Run query automatically mateenmohd SQL Server 2000 9 March 28th, 2004 03:35 PM
Run vb application automatically PbsiGuru General .NET 3 March 17th, 2004 04:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.