By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,304 Members | 1,739 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,304 IT Pros & Developers. It's quick & easy.

Prevent Access from closing

P: n/a
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
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
Malcolm:

Ignore that --

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

Willy

Nov 13 '05 #3

P: n/a
>
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

P: n/a
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

P: n/a
>Not a task you'd wish to undertake me thinks.

mmmmmmmmmm I gues you're right there.

Malcolm Webb
Nov 13 '05 #6

P: n/a

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 discussion thread is closed

Replies have been disabled for this discussion.