how to close a database

  • Thread starter Thread starter Shadow
  • Start date Start date
S

Shadow

When an Access databae is opened, there's a X button at the top right of the
window. ( just like every other application or window). Is there anyway to
run a macro/sub/function when this X button is clicked?
If not, is there any way to hide this button?

In Excell we can create a sub in workbook objects's on-close event. Is there
any way to do the same task in Access?

Any kind of help is much appreciated.

I need to oblige the users to click a button in a form to close the
database.

Ghalamkari
 
thanks for your help
I was on a trip and now am back.
will give it a try and will let you knwo

thanks




Kevin said:
Not sure if you can hide the x at the application level or
not, but there is a way to prevent them from using this.

Create a hidden form that is opened when the application
is started. Put a field on the form that has a default
value of 0. Then put the following code into the Unload
event for this hidden form:

Private Sub Form_Unload(Cancel As Integer)
dim foKtoClose as boolean

foKtoClose = Me![OkToClose]

Cancel = Not foKtoClose

End Sub

After you put this in, you will have to use the docmd.quit
command, but this will prevent someone from exiting the
database using the x in the application window.

Hope this helps!

Kevin
-----Original Message-----
When an Access databae is opened, there's a X button at the top right of the
window. ( just like every other application or window). Is there anyway to
run a macro/sub/function when this X button is clicked?
If not, is there any way to hide this button?

In Excell we can create a sub in workbook objects's on- close event. Is there
any way to do the same task in Access?

Any kind of help is much appreciated.

I need to oblige the users to click a button in a form to close the
database.

Ghalamkari
 
Back
Top