PC Review


Reply
Thread Tools Rate Thread

On Close vs. On Unload

 
 
=?Utf-8?B?REVJ?=
Guest
Posts: n/a
 
      11th Apr 2006
What is the difference between the Close event and the Unload event?

Thanks in advance.

DEI

 
Reply With Quote
 
 
 
 
RoyVidar
Guest
Posts: n/a
 
      11th Apr 2006
DEI wrote in message
<0F30D2F0-5569-4FBF-BA44-(E-Mail Removed)> :
> What is the difference between the Close event and the Unload event?
>
> Thanks in advance.
>
> DEI


The most interesting difference from my point of view, is that you can
cancel the closing of the form through the unload event through

cancel = true

--
Roy-Vidar


 
Reply With Quote
 
=?Utf-8?B?REVJ?=
Guest
Posts: n/a
 
      11th Apr 2006
For sure, but it seems that I can use the 'On Unload' event insteadof the 'On
Close' event.

So, does one supercede the other?

"RoyVidar" wrote:

> DEI wrote in message
> <0F30D2F0-5569-4FBF-BA44-(E-Mail Removed)> :
> > What is the difference between the Close event and the Unload event?
> >
> > Thanks in advance.
> >
> > DEI

>
> The most interesting difference from my point of view, is that you can
> cancel the closing of the form through the unload event through
>
> cancel = true
>
> --
> Roy-Vidar
>
>
>

 
Reply With Quote
 
RoyVidar
Guest
Posts: n/a
 
      11th Apr 2006
DEI wrote in message
<AE6FF8B2-05EF-4C98-BCE8-(E-Mail Removed)> :
> For sure, but it seems that I can use the 'On Unload' event insteadof
> the 'On Close' event.
>
> So, does one supercede the other?
>
> "RoyVidar" wrote:
>
>> DEI wrote in message
>> <0F30D2F0-5569-4FBF-BA44-(E-Mail Removed)> :
>>> What is the difference between the Close event and the Unload
>>> event?
>>>
>>> Thanks in advance.
>>>
>>> DEI

>>
>> The most interesting difference from my point of view, is that you
>> can cancel the closing of the form through the unload event through
>>
>> cancel = true
>>
>> --
>> Roy-Vidar
>>
>>
>>


I'm probably not familiar with the term "supercede", but when you
somehow invoke the process of closing a form, here are some of the
relevant form events, and the order in which they occur

on unload
on deactivate
on close

In the on unload event, as said, you can cancel the closing, which is
what I think is interesting. The other events, as far as I've
understood
does not allow for that, which means - if your intention is to
intervene
with the closing of the form, you must use the on unload event. After
that, the form will close.

--
Roy-Vidar


 
Reply With Quote
 
Brendan Reynolds
Guest
Posts: n/a
 
      13th Apr 2006
As Roy-Vidar says, the Unload event can be cancelled, the Close event can't.
So if you want to prevent the form from closing under certain circumstances,
the Unload event is the place to do that. If, on the other hand, you have
some code you want to only run if the form has definitely been closed, and
you do not want that code to run if the closing of the form is cancelled,
then the Close event might be a better choice. You could do it by using an
If ... Then ... Else ... End If in the Unload event, and placing the code
that should run only if the form is definitely going to be closed after the
'Else', but dividing the code between the two events is, in my opinion,
cleaner and more elegant.

--
Brendan Reynolds
Access MVP

"DEI" <(E-Mail Removed)> wrote in message
news:AE6FF8B2-05EF-4C98-BCE8-(E-Mail Removed)...
> For sure, but it seems that I can use the 'On Unload' event insteadof the
> 'On
> Close' event.
>
> So, does one supercede the other?
>
> "RoyVidar" wrote:
>
>> DEI wrote in message
>> <0F30D2F0-5569-4FBF-BA44-(E-Mail Removed)> :
>> > What is the difference between the Close event and the Unload event?
>> >
>> > Thanks in advance.
>> >
>> > DEI

>>
>> The most interesting difference from my point of view, is that you can
>> cancel the closing of the form through the unload event through
>>
>> cancel = true
>>
>> --
>> Roy-Vidar
>>
>>
>>



 
Reply With Quote
 
=?Utf-8?B?REVJ?=
Guest
Posts: n/a
 
      13th Apr 2006
Thank you for explaining that, I though there mught be a nuance in there.

"Brendan Reynolds" wrote:

> As Roy-Vidar says, the Unload event can be cancelled, the Close event can't.
> So if you want to prevent the form from closing under certain circumstances,
> the Unload event is the place to do that. If, on the other hand, you have
> some code you want to only run if the form has definitely been closed, and
> you do not want that code to run if the closing of the form is cancelled,
> then the Close event might be a better choice. You could do it by using an
> If ... Then ... Else ... End If in the Unload event, and placing the code
> that should run only if the form is definitely going to be closed after the
> 'Else', but dividing the code between the two events is, in my opinion,
> cleaner and more elegant.
>
> --
> Brendan Reynolds
> Access MVP
>
> "DEI" <(E-Mail Removed)> wrote in message
> news:AE6FF8B2-05EF-4C98-BCE8-(E-Mail Removed)...
> > For sure, but it seems that I can use the 'On Unload' event insteadof the
> > 'On
> > Close' event.
> >
> > So, does one supercede the other?
> >
> > "RoyVidar" wrote:
> >
> >> DEI wrote in message
> >> <0F30D2F0-5569-4FBF-BA44-(E-Mail Removed)> :
> >> > What is the difference between the Close event and the Unload event?
> >> >
> >> > Thanks in advance.
> >> >
> >> > DEI
> >>
> >> The most interesting difference from my point of view, is that you can
> >> cancel the closing of the form through the unload event through
> >>
> >> cancel = true
> >>
> >> --
> >> Roy-Vidar
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reset Label Caption on Form Close or Unload Samantha Microsoft Access Form Coding 3 2nd Jul 2008 06:15 PM
Unload, Close, Deactivate. Which event is best? Gabby Girl Microsoft Access 2 18th Mar 2008 02:39 AM
clearing recordsource on close/unload not working dfingas@gmail.com Microsoft Access 5 14th Feb 2007 03:14 PM
Close versus Unload, etc. =?Utf-8?B?WFA=?= Microsoft Access VBA Modules 2 21st Nov 2006 08:20 PM
unload assembly - AppDomain.Unload does not work as expected =?Utf-8?B?RGllcmsgRHJvdGg=?= Microsoft Dot NET Framework 2 4th Apr 2004 04:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:36 PM.