Re: Re: How to prevent Access app from closing with X button?
On Fri, 20 Jan 2006 02:15:05 GMT, "Rick Brandt"
<rickbrandt2@hotmail.com> wrote:
[color=blue]
>Lauren Wilson wrote:[color=green]
>> Hi folks,
>>
>> I believe I have seen this in this group in the past but my search
>> comes up with nothing so far.
>>
>> I want to prevent our Access application from closing without some
>> kind of confirmation from the user.
>>
>> We already have a tiny hidden form that loads from a function called
>> by the autoexec macro. I KNOW it is loading because I placed a
>> Debug.Assert IsOpen("formname") at the end of the function. That
>> Debug.assert works every time. In the Close event of the hidden
>> form, I placed a boolean choice bloc that asks the user if they are
>> sure they want to close the application. Even with a breakpoint set,
>> I cannot get that close event to fire when the app is closed by
>> Docmd.quit or when the user clicks the X button.
>>
>> What am I doing wrong? All replies much appreciated.
>>
>> --LW[/color]
>
>Something pretty basic. The unload and close events for all open objects
>definitely do fire when Access is closed. Perhaps you should post your code.[/color]
Thanks for your response. Actually, I figured it out. The Close
event has no cancel option. The Unload event does. My code works
perfectly when I move it to the Unload event and cancel it if the user
response is no. |