473,729 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5849
Malcolm:

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

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********@yah oo.co.uk> wrote in message
news:me******** **************@ mfwebb.compulin k.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(Can cel As Integer)
If MsgBox("Are you sure you want to exit..?", vbYesNo) = vbNo Then
DoCmd.CancelEve nt
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&Backu p 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
6585
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 tried. if i just enter minutes and click close, the form closes. it seems to bypass my nested if statement.
22
7574
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 otherwise it cancels the close. However, the user can still right click on the task bar and close my application. Is there any way of preventing this. Thanks Alex
4
410
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 don't know what I'm talking about take a look at MS CRM. Open a form, make some changes and try to close the form without saving first. Instead of closing the form you will be asked if you'd like to save first or discard the changes. I have often...
9
2283
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) as a popup using either window.open or window.showModalDialog. Since I want to warn the users of my application when they try to close page1.aspx and have changed the values in the meantime I thought about using the “onbeforeunload” event of the...
2
3528
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 List" which causes "Program not responding"...press "Cancel" and no issues, press "End now" and sure enough it ends. My question is; is there any method to prevent the "Application not responding" message from appearing? Current code:
2
2440
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 confirmation from the user. We already have a tiny hidden form that loads from a function called by the autoexec macro. I KNOW it is loading because I placed a
4
3131
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 cancels the close event if the BeforeUpdate code fires '4/16/06 see...
3
13056
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 not be used. is there any way to do this? is it posiible to do the same thing with anycode?
7
5237
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 click. also when designing, going to design mode saves the record. So I tried: OnClose : Me.Undo. My own cancel button uses it and it works ok,
0
8761
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9281
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8148
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2680
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.