Re: How to prevent Access from Closing
From: Steve Schapel (schapel_at_mvps.org.ns)
Date: 12/13/04
- Next message: kiwibruce: "Re: VBA references"
- Previous message: judith: "email an attachment"
- In reply to: Irshad Alam: "How to prevent Access from Closing"
- Next in thread: Irshad Alam: "Re: How to prevent Access from Closing"
- Reply: Irshad Alam: "Re: How to prevent Access from Closing"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 13 Dec 2004 21:28:50 +1300
Irshad,
I think this may be similar to what you saw on The Access Web:
1. Open your Switchboard form in design view, and open the VB Editor
window (via the View|Code menu).
2. At the top of the module, put the following right after where it says:
Option Compare Database
Option Explicit
Dim AllowClose As Boolean
3. In the On Load event property of the form, put this code...
AllowClose = False
4. On the On Click event property of the button you use to close the
database, put this...
AllowClose = True
<then your other code to close the database etc>
5. On the On Unload event property of the form, put this...
If Not AllowClose Then
MsgBox "Please use the button!"
Cancel = True
End If
-- Steve Schapel, Microsoft Access MVP Irshad Alam wrote: > I want to make sure that Users always exit my database using Exit Button > provided on my SwitchBoard Form. How ever I am unable to prevent them from > Closing Access Itself, As the user click on X Button of Windows and it closes > Access. Is there a way to control how to exit Access. > Please note that my SwitchBoard Form remains open till user Exit the database. > > There was a tips on Webpage: www.mvps.org/Access , But the method is not > working. > > Could any of the professionals can advise me what to do in details, as I am > not very good in Access VB coding. > >
- Next message: kiwibruce: "Re: VBA references"
- Previous message: judith: "email an attachment"
- In reply to: Irshad Alam: "How to prevent Access from Closing"
- Next in thread: Irshad Alam: "Re: How to prevent Access from Closing"
- Reply: Irshad Alam: "Re: How to prevent Access from Closing"
- Messages sorted by: [ date ] [ thread ]