[AccessD] Removing Exit ability

Gowey Mike W Mike.W.Gowey at doc.state.or.us
Thu Apr 8 10:06:50 CDT 2004


Thank you Colby that works like a charm. 


Mike Gowey, MCSA, A+, ACE
Team Leader - SRCI
Information Systems & Services Division

-----Original Message-----
From: John W. Colby [mailto:jwcolby at colbyconsulting.com] 
Sent: Thursday, April 08, 2004 8:08 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] Removing Exit ability

Access cannot close if it cannot close all forms.

1) In the form with your button, create a boolean variable in the code
header.
2) In the form Open set the boolean false - in fact it will already be
false but still... that's the theory.
3) In the form's Unload check if the bln is true and if not set cancel =
true.  This prevents the form closing thus prevents Access closing.
4) In the command button to close the form, set the boolean true (allow
the
close) then run the code that closes Access.

dim blnAllowClose as boolean

Private Sub Form_Open(Cancel As Integer)
    	blnAllowClose =false
End Sub

Private Sub Form_Unload(Cancel As Integer)
    	if blnAllowClose = false then
		cancel = true
    	end if
End Sub

Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click

	blnAllowClose = true
	Application.Quit acQuitSaveNone

Exit_cmdClose_Click:
    Exit Sub

Err_cmdClose_Click:
    MsgBox Err.Description
    Resume Exit_cmdClose_Click

End Sub

John W. Colby
www.ColbyConsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Gowey Mike W
Sent: Thursday, April 08, 2004 9:46 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Removing Exit ability



Hi Everyone,

Could anyone please tell me how I can remove the ability for the user to
click on the X to close Access, I want them to only be able to use the
buttons I have created on the forms to exit the program.

Thanks for any help.


Mike Gowey, MCSA, A+, ACE
Team Leader - SRCI
Information Systems & Services Division



--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list