Macro to execute when Access 97 closes

  • Thread starter Thread starter awrbulldog
  • Start date Start date
A

awrbulldog

Guest
I have a macro that exports reports from an Access 97 DB to a shared folder. I am exporting the reports as .snp files (snapshot files).

How can I have this macro automatically execute whenever someone closes the database just by clicking file and then close? (My company does not use a switch board which would allow for such a thing)

I know that access has an 'AutoExec' - if you name your macro autoexec it will automatically run whenever you open your database. Why isn't there and autoexit like word and excel have?

Any help?
 
Here is what the code looks like:
Could you be more specific and possibly give code example. I don't know what you mean by hidden form.

Thanks for all the help!

Option Compare Database
Option Explicit

'------------------------------------------------------------
' DatabaseReports
'
'------------------------------------------------------------
Function DatabaseReports()
On Error GoTo DatabaseReports_Err

DoCmd.OutputTo acReport, "rptRetreats2004Count", "SnapshotFormat(*.snp)", "H:\Retreat Information\rptRetreats2004Count.snp", False, ""
DoCmd.OutputTo acReport, "rptRetreats2003Count", "SnapshotFormat(*.snp)", "H:\Retreat Information\rptRetreats2003Count.snp", False, ""


DatabaseReports_Exit:
Exit Function

DatabaseReports_Err:
MsgBox Error$
Resume DatabaseReports_Exit

End Function
 

Users who are viewing this thread

Back
Top Bottom