473,409 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

Closing Database Using Quit Button

13
I have designed a database and have used the following code to disable the standard Microsoft close button. I want my users to have to click on a Quit button on the switchboard:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Unload(Cancel As Integer) 
  2. Dim LResponse As Integer
  3.  
  4. LResponse = MsgBox("Please Use Quit Button on Main Menu", vbOKOnly)
  5. If LResponse = vbOK Then
  6. Cancel = True
  7. End If
  8.  
  9. End Sub
  10.  
They get a pop-up reminder that they have to press OK on - which works well - nothing closes. The problem is that they then get the same reminder when they actually press the Quit button - when the press OK it then closes the database, but I want it to close without having to have this pop-up on the Quit Click.
Anyone got any code for this?
Thanks!
EAC
Mar 27 '08 #1
2 2200
Stewart Ross
2,545 Expert Mod 2GB
Hi. The Form_Unload event is raised whenever the form is being closed, so it is correctly fired from your quit routine just as it is after a press of the window close button.

If you do not want to have the close button on the form then set the form's Close Button property to No. That way you won't have to disable the close at all.

If you include the close button don't try to bypass it and force users to use your quit button instead - you will just confuse your users. You could always call your quit routine from the form unload or close events so that whatever processing your Quit button does is still done.

-Stewart
Mar 27 '08 #2
SoNew
13
I have disabled the one on the form - it is the actual database close button on the main background page that is the problem (sorry for the lack of technical terms - I don't know access all that well).
Mar 27 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Marcus Schneider | last post by:
Normally I close my windows/widgets with destroy and it works fine. Now I have a window (let's call it 1) from where I open an additional window (let's call it 2). I close it. Each window has its...
8
by: simon place | last post by:
Spent some very frustrating hours recoding to find a way of closing a server socket, i'd not thought it would be any problem, however, after complete failure and as a last resort, i looked at the...
1
by: Nathan Bloom | last post by:
Is there a way to force the user of a database to exit and close access through a close button on for example a switchboard menu? If a user closes access by the exit command or the close button...
5
by: nick_faye | last post by:
Hi, I am still a newbie to VB and using MS Access 2000. I am currently trying to provide a preview of reports before printing them. My program is simple: AC.DoCmd.OpenReport "MyReport",...
22
by: alecjames1 | last post by:
I have a form which the user must complete before closing. I have disabled the window x button and use my own exit button. When selected it checks to see if the user has completed the entries...
2
by: AA Arens | last post by:
I have a button which exits the database, but it actually Closes the base, because Access is still active. How to have it exitting the Access app. as well?
8
by: flickimp | last post by:
Hi Have set up a databasde with a quit command button for the user. When the user closes the database, the databse compacts and repairs itself (using the standard tools option). Now then.......
1
by: SoNew | last post by:
I have designed a database and have used the following code to disable the standard Microsoft close button. I want my users to have to click on a Quit button on the switchboard: Private Sub...
10
by: John | last post by:
Hi My app does a few processes and the app can not be closes mid way. Therefore I want to be able to block any attempt of closing app by user such as by clicking on close (cross) or Alt-F4 and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.