Solved

MSAccess Application Close Event

Posted on 2011-09-19
12
296 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
  • 6
  • 3
  • 2
  • +1
12 Comments
 
LVL 29

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
 
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 29

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 - Access MVP) 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Outlook Free & Paid Tools
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

911 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now