Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automate email of report

Status
Not open for further replies.

bersh

IS-IT--Management
Aug 9, 2000
9
US
I am trying to automate the emailing of a report everyday at 5:30pm. Thus far I have created the report, I have created a macro to email the report to recipients. Now I just have to figure out how to trigger this macro at 5:30pm everyday. Any ideas?????
 
You can create a form that you make invisible.
on its Load and Timer event put VB code that does the following:

1. in the Load Event, set the form's TimerInterval property to a desired time...
Me.TimerInterval = 1000 (i think 1000 is eqiv of 1 second)

2. in the Timer event put code that will do the following:
- check the time to see if it is 5:30pm
- run desired macro or code

If you need any specifics, go ahead and ask and I'll see if I can draw up a sample database or just paste some code here

if in doubt, look up Access Help on how to use the Timer event and TimerInterval property.
Hope you figure it out! Earnie Eng
If you are born once, you will die twice.
If you are born twice, you will die once
 
here is a copy/pasted of the help file I used to come up with that idea:

Remarks
The TimerInterval property setting is a Long Integer value between 0 and 2,147,483,647.

You can set this property by using the form's property sheet, a macro, or Visual Basic.

Note When using Visual Basic, you set the TimerInterval property in the form's Load event.

To run Visual Basic code at intervals specified by the TimerInterval property, put the code in the form's Timer event procedure. For example, to requery records every 30 seconds, put the code to requery the records in the form's Timer event procedure, and then set the TimerInterval property to 30000.


Example
The following example shows how to create a flashing button on a form by displaying and hiding an icon on the button. The form's Load event procedure sets the form's TimerInterval property to 1000 so the icon display is toggled once every second.
Code:
Sub Form_Load()
    Me.TimerInterval = 1000
End Sub

Sub Form_Timer()
    Static intShowPicture As Integer
    If intShowPicture Then
        ' Show icon.
        Me!btnPicture.Picture = "C:\Icons\Flash.ico"
    Else
        ' Don't show icon.
        Me!btnPicture.Picture = ""
    End If
    intShowPicture = Not intShowPicture
End Sub
Earnie Eng
If you are born once, you will die twice.
If you are born twice, you will die once
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top