Acess - Closing

A

Abay

Hello ... is there a way to inhibit the use of the windows close option when
exiting Access. We have a number of applications that depend on the user
using the application exit button to quit as they have some procures that
are triggered by same.

As always any help on this is much appreciated.

Abay
 
D

Douglas J. Steele

Ensure that you have a form that's always open. In that form's Unload event,
put code that checks whether they've got there in the required manner (use a
global variable, for instance) If they haven't done what they needed to, set
Cancel = True, which will prevent the form from closing.
 
A

Armen Stein

Ensure that you have a form that's always open. In that form's Unload event,
put code that checks whether they've got there in the required manner (use a
global variable, for instance) If they haven't done what they needed to, set
Cancel = True, which will prevent the form from closing.

Yes, but be careful with Globals - they are cleared using this
technique. We don't use long-term globals, unless they are wrapped in
a function that reloads them if they're empty.

We use a hidden field on that always-open form to track whether the
user has already confirmed (via the normal Exit button on the form)
that they really want to exit the application.

Armen Stein
Microsoft Access MVP
www.JStreetTech.com
 
D

Douglas J. Steele

Armen Stein said:
Yes, but be careful with Globals - they are cleared using this
technique. We don't use long-term globals, unless they are wrapped in
a function that reloads them if they're empty.

We use a hidden field on that always-open form to track whether the
user has already confirmed (via the normal Exit button on the form)
that they really want to exit the application.

You're right: using a hidden field is a much better idea.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top