Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Developer Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
closing the database
Mark Desens 
      
3 years ago
Hey guys I am wondering if there is a video on preventing closing the database using the red X on the top right. No matter what form is open We need to get the users to go through the Exit and not the X. Can we disable it, hide it or if they click it then nothing happens. We don't want a popup after they click it. We just want it not to close. Thanks.
Richard Rost  @Reply  
           
3 years ago
Richard Rost  @Reply  
           
3 years ago
Nothing can stop them from force closing it with the Windows Task Manager however, if they know how.
Mark Desens OP  @Reply  
      
3 years ago
Hey Richard, I tried playing with those videos and using code. The one I couldn't close anything because it disabled the close button. Is there a code that we can place in a module to hide the red X but not disable it, just hide it. I can hide the close button on a form.
Richard Rost  @Reply  
           
3 years ago
To the best of my knowledge, you can't hide the 'X' to close the application itself; that's a Windows thing. There may be some Windows API code out there that you could use, but I'm not aware of any. However, if you prevent people from closing your main menu, as I show in the video, you can control what happens if they do try to close the database, which will attempt to close the main menu. You can cancel that event.
Richard Rost  @Reply  
           
3 years ago
But yes of course you can you can hide the close button on the form that's in the form's properties. You have to hide the close button and the control box.
Mark Desens OP  @Reply  
      
3 years ago
I see, ok well I need to find the best option for only the 2 forms.Thanks again for the help.
Kevin Yip  @Reply  
     
3 years ago
You also can't prevent the user from shutting down the PC, which will shut down Access and every running process.  If you somehow take away their keyboards and mice, they can still press the power button to shut the PC down.  Instead of spending time and effort to do this kind of thing (which is futile anyway), spend it on handling the events that occur when the user shuts down the form or the app.
Mark Desens OP  @Reply  
      
3 years ago
Hi Kevin and yes that's what I am doing. The computer needs to stay on in order for the database to still maintain it's connectiion to the back end. I do believe I have it solved. Richard has that video on the yesnocancel, the three way choice. I'll be using that on the forms just worded according to the forms. Thanks Kevin.
Giovanni Miranda  @Reply  
    
3 years ago
Well, I've done this with my Main Form as well and all works fine, but...when I'm on my Main Form and I click on the top border so I can go into design view it puts up the Warning message.  I've tried to use the design button on the very top menu as well as the design button at the lower right of the form as well and it still gives me that message.  But, if I do click on "Yes" it does take me to the Design Form.  I've got the code the same as what was shown on the video, any suggetions or advice on why I'm getting that Warning message when I try to get into Design View?  It also happens when I'm coming out of Datasheet View.
Scott Axton  @Reply  
        
3 years ago
The form in effect has to shutdown before it goes into design so the same event that you have in place to prevent shut down occurs when you go into design mode.

That is why you see what you do.
Gregory Clancey  @Reply  
    
3 years ago
I haven't reviewed all of the helpful advice and good humor in this thread, but maybe a simple process I use can help a bit.
I close my database with VBA from a CommandButton marked (QUIT). I've added a small table to the DB in which I record the DateTime stamp of the moment of "quitting." This is displayed on the Form which opens automatically at the DB startup. This doesn't prevent you from stupidly altering a lot of code in an ill-named backup, but can at least keep you on the last used generation of the project.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 10:21:29 PM. PLT: 1s