Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent Access from closing? 1

Status
Not open for further replies.

rickyoswaldiow

Programmer
Jul 16, 2007
127
0
0
GB
Greetings everyone, I have recently started a new job as a programmer working with Access 2002/VBA and SQL. I am wondering if there is a way to prevent the 'x' button from working in Access, we have removed the 'x' from the VBA forms but somtimes users accidently hit the main one and it can get rather annoying if you are in the middle of doing somthing!
 
That's excellent, works a treat. I was wondering, what kind of load will this put on the processor? Our databases can be pretty vast and some of our clients have computers from the stone age - will calling these API commands slow down the execution much?
 
You could try the following

If you have a main form insert the following code:

Code:
Option Compare DataBase
Option Explicit

Public bAllowClose as Boolean


Private Sub Form_Unload(Cancel as Integer)
    Cancel = Not(bAllowClose)
End Sub

You would then include a button that the user has to use to logout or close the application. The code would be then as follows

Code:
Private cmdClose_Click()
     bALlowClose = true
     DoCmd.Quit
Sub End


 
That method seems a lot neater! But since my boss just uploaded it to the live version, I'll leave it as it is ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top