Solved

Ms Access control an unintended close of the application

Posted on 2013-02-01
2
357 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
2 Comments
 
LVL 11

Accepted Solution

by:
Guru Ji earned 250 total points
Comment Utility
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
Comment Utility
Thanks, Worked perfectly!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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…

743 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

13 Experts available now in Live!

Get 1:1 Help Now