?
Solved

Ms Access control an unintended close of the application

Posted on 2013-02-01
2
Medium Priority
?
368 Views
Last Modified: 2013-02-01
I have a main form with a close button that has code that tests for the unintended exit of the app.  This works fine.  Any attempt to put similar code in the form unload event does not work.  Users sometimes mistakenly hit the close control on the main menu.  Is there a way to catch that and cancel the closing of MS Access?  Thanks
0
Comment
Question by:Sbovino
[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
2 Comments
 
LVL 11

Accepted Solution

by:
Guru Ji earned 1000 total points
ID: 38844782
You can't cancel the close event but you can cancel the unload event, so you can put this in your unload event and it will prompt you when closing.


Private Sub Form_Unload(Cancel As Integer)

    If MsgBox("Test", vbYesNo + vbExclamation, "Confirm close") <> vbYes Then
         Cancel = True
    End If

End Sub
0
 

Author Closing Comment

by:Sbovino
ID: 38844815
Thanks, Worked perfectly!
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Suggested Courses

765 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