Printing report on Nth day of month

  • Thread starter Thread starter Ken Warthen
  • Start date Start date
K

Ken Warthen

I have a report in an Access 2007 application that I send as a pdf email
attachment to a coworker on the 15th of each month. I'd like to automate the
process and have the email and attachment functionality working, but can't
figure out how to automate the date event. Any help or direction would be
greatly appreciated.

Ken
 
Ken Warthen said:
I have a report in an Access 2007 application that I
send as a pdf email attachment to a coworker on the
15th of each month. I'd like to automate the process
and have the email and attachment functionality working,
but can't figure out how to automate the date event.

An Access application can't "start itself", but Windows allows you to write
scripts can to start an application based date and time (don't ask me -- I
don't do Windows scripts). There's a command line parameter that lets you
specify a macro to be run when you start up an Access application.

Or, if you are _certain_ that your Access application will be started up
(loaded and entered by a user) on every 15th, then you can save in a local
table the last date the e-mail was sent and compare today's date to the
15th, and send the e-mail if need be, in your Startup code. If today's date
is greater than the last date the e-mail was sent and today's date is the
15th or later, run the report and send the e-mail.

MVP Stephen Lebans, http://www.lebans.com, has a snapshot-to-pdf feature
that you can download and use for free (but without any support, except what
you can get in the newsgroups), if you are still working on that aspect of
the problem.

Larry Linson
Microsoft Office Access MVP
 
Thanks for the suggestions Larry. The application will be run everyday.
Since it's an Access 2007 application I can use the SaveAs PDF utility. I
just needed some help on how to check for the 15th of the month on startup.

Ken
 
Ken said:
I have a report in an Access 2007 application that I send as a pdf email
attachment to a coworker on the 15th of each month. I'd like to automate the
process and have the email and attachment functionality working, but can't
figure out how to automate the date event. Any help or direction would be
greatly appreciated.

Ken

Hallo Ken,

if ACCEES is started every day, you can use an autoexec-macro:

First write a public funtion similar to this one

Public Function start_report()
If (Left(Format(Now(), "dd.mm.yyyy"), 2) = "15") Then
DoCmd.OpenReport (yourReport)
End If
End Function

Second you define a macro. Its name must be "autoexec".
In this macro you choose "exec code" or "execute code" (I don't know
what Access offers in the english version).
As funtionname you give start_report()

That's all!

Karsten
 
Somewhere in your startup code:

If Day(Date) = 15 Then
'Run the Report
End If

Now, there is a gotcha here. If this is a multi user application or if you
close the application and restart it at any time on the 15th, it will send
the report again. So, you need to determine the rules on who should send it
(specific person or first person in or someone on a list, etc) and design a
way to know it has already been sent for a specific date. Now you need to
write a procedure to produce the report taking those things into
consideration.
 
Back
Top