[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Ms Access control an unintended close of the application

Posted on 2013-02-01
2
Medium Priority
?
370 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
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.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…

650 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