Solved

MSAccess Application Close Event

Posted on 2011-09-19
12
325 Views
Last Modified: 2012-05-12
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
Comment
Question by:Lambel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
  • +1
12 Comments
 
LVL 30

Expert Comment

by:Randy Downs
ID: 36562907
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
 
LVL 75
ID: 36562911
" 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
 
LVL 75
ID: 36562920
Number-1:
Just curious ... how does that link relate to this question?

mx
0
Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 
LVL 61

Expert Comment

by:mbizup
ID: 36563021
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
 

Author Comment

by:Lambel
ID: 36563088
DatabaseMX:  Can I use frmHiddenForm.Visable = False  to hide the form?
0
 
LVL 75
ID: 36563126
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
 
LVL 30

Expert Comment

by:Randy Downs
ID: 36563144
Sorry guys, my post was for another question. Maybe someone will remove.
0
 
LVL 75
ID: 36563158
no prob ... thought that was the case.

mx
0
 

Author Comment

by:Lambel
ID: 36563363
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
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 500 total points
ID: 36563382

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

mx
0
 

Author Closing Comment

by:Lambel
ID: 36563406
That did it - thanks much.

Lynn
0
 
LVL 75
ID: 36563424
ooook ...you are welcome.

mx
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question