473,387 Members | 1,897 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,387 software developers and data experts.

Prevent Access from closing

I have experimented with the routine to prevent access from closing using
the module authored by Dev Ashish to be found at "The Access web" site.

Whilst this seems to work, it is not exactly what I would like to do.

My database has an Exit&Backup routine called from the exit button on my
Main Menu. It is a simple form with options to backup to a choice of
specified drives, cancel or exit without backup.

What I would really like to do is to have this Exit&Backup Form display
when the X in the top right hand corner of access is pressed.

Does anyone know of a way to make the X button in Access 2000 open a
specific form from the current database?

Many thanks in advance.

Malcolm Webb
Nov 13 '05 #1
6 5825
Malcolm:

This may be trivializing your problem but there is a "compact on close"
option under Tools|Options|General...

Otherwise you can try putting your exit routine in your main form's "On
Close" event procedure. I believe this will run when the either the
program or form closes...

Willy

Nov 13 '05 #2
Malcolm:

Ignore that --

I got compact mixed up with backup...I'm new at this...

Willy

Nov 13 '05 #3
>
Otherwise you can try putting your exit routine in your main form's "On
Close" event procedure. I believe this will run when either the
program or form closes...


I thought we were on to something there:-) Tried it, but when the X
button is hit, my Exit&Backup Form flashes on the screen then disappears
as the application quits.

I would like the Exit&Backup Form to remain on the screen until one of the
buttons on that form is actioned -- backup, cancel or exit without backup.

I have a genealogy programme which does just that -- displays the exit
routine when the X button is pressed. That's where I got the idea from.

Why do I want to do it this way?

Because I have a habit of closing down other programmes by hitting the X
button and a message box displays prompting me to save the changes.

I do occasionally hit the X button by mistake when working in my database
and I want to be reminded "not to be silly" before being dumped out of the
database.

Malcolm Webb
Nov 13 '05 #4
Hitting the 'X' on the main Access window has the same effect as any other
program, i.e. it closes the program; unless the *software* has been
specifically designed to operate some other way (as your genealogy program).
The only way to overcome this would be to reverse-engineer Access find the
main onClose function (can't remember the exact name of the API function)
and to add in a routine to cause the software to operate in a different
fashion when the 'X' is clicked.

Not a task you'd wish to undertake me thinks.

mori


"Malcolm Webb" <mf********@yahoo.co.uk> wrote in message
news:me**********************@mfwebb.compulink.co. uk...

Otherwise you can try putting your exit routine in your main form's "On
Close" event procedure. I believe this will run when either the
program or form closes...


I thought we were on to something there:-) Tried it, but when the X
button is hit, my Exit&Backup Form flashes on the screen then disappears
as the application quits.

I would like the Exit&Backup Form to remain on the screen until one of the
buttons on that form is actioned -- backup, cancel or exit without backup.

I have a genealogy programme which does just that -- displays the exit
routine when the X button is pressed. That's where I got the idea from.

Why do I want to do it this way?

Because I have a habit of closing down other programmes by hitting the X
button and a message box displays prompting me to save the changes.

I do occasionally hit the X button by mistake when working in my database
and I want to be reminded "not to be silly" before being dumped out of the
database.

Malcolm Webb

Nov 13 '05 #5
>Not a task you'd wish to undertake me thinks.

mmmmmmmmmm I gues you're right there.

Malcolm Webb
Nov 13 '05 #6

Malcolm Webb wrote:
Not a task you'd wish to undertake me thinks.


mmmmmmmmmm I gues you're right there.

Malcolm Webb

Create a hidden form and set it as the "Display Form"in the
Tools->Startup menu options.
In the "On Unload" event of this form place the following code:

Private Sub Form_Unload(Cancel As Integer)
If MsgBox("Are you sure you want to exit..?", vbYesNo) = vbNo Then
DoCmd.CancelEvent
Exit Sub
Else
DoCmd.Quit
End If
End Sub
This will stop Access closing automatically when the users click the
"X" in the top right hand corner of the Access Application.

Place your "Exit&Backup routine called from the exit button on my
Main Menu" instead of the code above.

osmethod

Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Miguelito Bain | last post by:
hi everybody- i have a form with 2 fields on it that i want the user to fill out before he or she can save the record, close the record, or move to the next record, etc... here's the code i...
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...
4
by: Daniel Walzenbach | last post by:
Hi, does anybody know the JavaScript the guys at Microsoft used in MS CRM to prevent people from closing a browser window and asking them (on the client) what they really want to do? If you...
9
by: Daniel Walzenbach | last post by:
Hi I am faced with the following problem: I have a page (let’s call this page page1.aspx) containing some TextBoxes and a hyperlink which opens another page (let’s call this page page2.aspx)...
2
by: kevininstructor | last post by:
I want to prevent a user from closing an application while doing critical operations. The following code (concept came from MSDN) works except for when the user attempts to terminate via "Task...
2
by: Lauren Wilson | last post by:
Hi folks, I believe I have seen this in this group in the past but my search comes up with nothing so far. I want to prevent our Access application from closing without some kind of...
4
by: tlyczko | last post by:
I have been looking on the NGs and I found this code to show if a subform has no records. I have this code in the MAIN form OnClose event: Private Sub btnClose_Click() '4/16/06 new code that...
3
by: sravan_reddy001 | last post by:
i want to prevent a form from closing.. to do this i want to handle the formClosing or FormClosed events. from here i want to prevent the form from closing. New instance of same form should...
7
by: Michiel Rapati-Kekkonen | last post by:
Hi, I would like my record to be saved only when my own close button (with all it's checks) is used. I made the winodws close button disappear, but you still can close using the right mouse...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.