Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 10th, 2005, 05:00 AM
Friend of Wrox
Points: 894, Level: 11
Points: 894, Level: 11 Points: 894, Level: 11 Points: 894, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: Dublin, , Ireland.
Posts: 180
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, "Brendan.Bartley@anpost.ie", "", "", "Reports", "Hi here are the reports", False


End If
End Sub
Thanks

Brendan Bartley


__________________
Brendan Bartley
Reply With Quote
  #2 (permalink)  
Old June 10th, 2005, 05:09 AM
Friend of Wrox
 
Join Date: Jan 2005
Location: , , United Kingdom.
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

Reply With Quote
  #3 (permalink)  
Old June 10th, 2005, 11:07 PM
Authorized User
 
Join Date: Dec 2004
Location: Bakersfield, CA, USA.
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


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
run a program automatically hastikeyvan ASP.NET 2.0 Professional 1 December 18th, 2009 02:34 PM
making application run automatically liamfitz Pro VB 6 4 January 23rd, 2008 04: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 02:35 PM
Run vb application automatically PbsiGuru General .NET 3 March 17th, 2004 03:18 AM



All times are GMT -4. The time now is 03:40 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.