SendObject: Send report at 08:00 in the morning automattically

  • Thread starter Thread starter ant1983
  • Start date Start date
A

ant1983

Hi,

I have a command button cmdEmailSchedule that runs a SendObject Macro that
basically emails a report rptStats to a recipient.

Is there a way that i can put a timer or something on that button or on that
report or something so that 08:00 every morning the report emails
automatically.

I realise the database would need to be open for that to happen so that is
not really an issue at this stage?

thanks

ant1983
 
Hi,

I have a command button cmdEmailSchedule that runs a SendObject Macro that
basically emails a report rptStats to a recipient.

Is there a way that i can put a timer or something on that button or on that
report or something so that 08:00 every morning the report emails
automatically.

I realise the database would need to be open for that to happen so that is
not really an issue at this stage?

thanks

ant1983


Here's how I've done it in the past.
You can start your database with command line parameters.

path/msaccess.exe path2/yourdatabase.mdb /cmd Run800

The "Run800" code can be anything you want. Just need to remember it
for the next step. In the form that opens when your database starts,
put this code in the Load event.

Private Sub Form_Load()
If Command = "Run800" Then
cmdEmailSchedule_Click
End If
'possibly some other code you need to run
End Sub

Now if you just open the database, everything works normal, but if you
start it with the /cmd Run800 parameter, it will automatically fire
the command button click event.

The final step is to create a scheduled task that runs at 8:00

Start, Settings, Control Panel, Scheduled Tasks, Add Scheduled Task

You can choose what days of the week to run and set some other
parameters. Set it fire the command line from above, and you're set.

The help files should give more detail.

Hope this helps,
Chris M.
 
Back
Top