• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 338
  • Last Modified:

MSAccess Application Close Event

I need to run a procedure that will delete all the tables and table links in my mdb file when the application closes.  Where is the best place to trigger this?  Is there an application On_Close event?

Thanks,
Lynn
0
Lambel
Asked:
Lambel
  • 6
  • 3
  • 2
  • +1
1 Solution
 
Randy DownsOWNERCommented:
Maybe this will help

http://forums.techguy.org/windows-xp/472515-windows-xp-icons-highlighted.html

Display properties->customize desktop->clicked on the web tab->and in the "Web pages" box there was a "\" that was checked.
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
" Is there an application On_Close event?"
Unfortunately, no.  This feature has been requested many times.

One way is to have a hidden form that opens with your app.  Then, in the UnLoad event of that form you can run your code to do whatever you need.
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Number-1:
Just curious ... how does that link relate to this question?

mx
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
mbizupCommented:
If your database exits abnormally, your procedure would not run.

Are you trying to set the database up for the next session?

It seems like the most reliable time to do this would be at startup rather than exit/closing.


0
 
LambelAuthor Commented:
DatabaseMX:  Can I use frmHiddenForm.Visable = False  to hide the form?
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
You can open the Form like this ... possibly from an Auto Exec macro that runs start up code ... or directly in the Macro as an Action.

DoCmd.OpenForm "YourFormName",,,,,acHidden
0
 
Randy DownsOWNERCommented:
Sorry guys, my post was for another question. Maybe someone will remove.
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
no prob ... thought that was the case.

mx
0
 
LambelAuthor Commented:
Ok, I've got the form opening up in hidden mode, but now the DoCmd.Close "frmHiddenForm" is erroring out with a "type mismatch".
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:

I think you want:
Docmd.Close acForm,"frmHiddenForm"

mx
0
 
LambelAuthor Commented:
That did it - thanks much.

Lynn
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
ooook ...you are welcome.

mx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 6
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now