how do i send report by email upon closing database

  • Thread starter Thread starter Anna
  • Start date Start date
A

Anna

I created a macro to automatically run a report to send to distribution list
via email. i am having to run the macro manually. I want for the macro to
run when i click on the exit database button. how do i do this?
 
Anna,
What button are you referring to?
If you are using the Access database screen's File/Exit, or the X to
close,
there are no events associated with that, and consequently... no place to
code to
run a report.
Most database applications have some sort of startup form... like a
Main Menu, and an "Exit Application" button on that form could be used to
run the report just before closing the appplication, and Access.

Private Sub cmdExitApplication_Click()
DoCmd.OpenReport "YourReport"
DoCmd.Quit
End Sub
--
hth
Al Campagna
Microsoft Access MVP 2007-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
Anna,

You have said that you already have the macro created.

So now, in design view of the form, select your command button, look at the
Properties, find the 'On Click' property, and from the drop-down list in
that On CLick property box, enter the name of your macro.
 
Back
Top