By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,286 Members | 2,422 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,286 IT Pros & Developers. It's quick & easy.

deactivate event fires every OTHER time

P: n/a
I have two forms, a menu and a data entry form. The entry form is bound
to a query against linked SQL server tables. In the deactivate event, I
have some code which asks the user if they want to save their changes and
they can respond with yes, no or cancel. If they press cancel, the entry
form stays active with the changes still entered.

So, if I'm on the entry form and have entered data, and then click on the
menu, the deactivate event fires and I get the correct prompt. If I press
cancel, I stay on the entry form. But if I click AGAIN on the menu form,
I've confirmed that the deactivate event doesn't fire so the menu form
becomes active without prompting the user. If I then click back to the
entry form and do it all over, the deactivate event DOES run and the
prompt is issued. So, the deactivate event is firing every OTHER time I
click on the menu form.

I notice that on the times that the deactivate event DOES fire, and I
select cancel and return to the entry screen, the activate event for the
entry screen fires, and then the activate event for the menu screen fires
after that even though the entry screen is the one which will have focus.
I suspect this is related.

Thanks in advance for any help on this question.

-Maxine

--
mg at pcg dot net
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
TC
Deactivate() is not a common event from which to ask the user to save
changes.

Perhaps use the form's BeforeUpdate event? That will fire when the form is
actually about to save a new or edited record. If you cancel that event, the
new or updated data is not saved, but remains in the form. If you Me.Undo,
the new or updated data is discarded & the form goes back to "square one".

HTH,
TC
"Maxine G" <mg@nospam.com> wrote in message
news:Xn***************************@64.164.98.50...
I have two forms, a menu and a data entry form. The entry form is bound
to a query against linked SQL server tables. In the deactivate event, I
have some code which asks the user if they want to save their changes and
they can respond with yes, no or cancel. If they press cancel, the entry
form stays active with the changes still entered.

So, if I'm on the entry form and have entered data, and then click on the
menu, the deactivate event fires and I get the correct prompt. If I press
cancel, I stay on the entry form. But if I click AGAIN on the menu form,
I've confirmed that the deactivate event doesn't fire so the menu form
becomes active without prompting the user. If I then click back to the
entry form and do it all over, the deactivate event DOES run and the
prompt is issued. So, the deactivate event is firing every OTHER time I
click on the menu form.

I notice that on the times that the deactivate event DOES fire, and I
select cancel and return to the entry screen, the activate event for the
entry screen fires, and then the activate event for the menu screen fires
after that even though the entry screen is the one which will have focus.
I suspect this is related.

Thanks in advance for any help on this question.

-Maxine

--
mg at pcg dot net

Nov 12 '05 #2

P: n/a
Thanks. I've used deactivate in other settings for this (such as VB). I
don't think the BeforeUpdate event will fire if you simply click off the
form. And that's what we're trying to do - prevent the user from leaving
the form without explicitly saving or canceling changes.

-Maxine
mg at pcg dot net

"TC" <a@b.c.d> wrote in news:1063705972.19288@teuthos:
Deactivate() is not a common event from which to ask the user to save
changes.

Perhaps use the form's BeforeUpdate event? That will fire when the
form is actually about to save a new or edited record. If you cancel
that event, the new or updated data is not saved, but remains in the
form. If you Me.Undo, the new or updated data is discarded & the form
goes back to "square one".

HTH,
TC
"Maxine G" <mg@nospam.com> wrote in message
news:Xn***************************@64.164.98.50...
I have two forms, a menu and a data entry form. The entry form is
bound to a query against linked SQL server tables. In the deactivate
event, I have some code which asks the user if they want to save
their changes and they can respond with yes, no or cancel. If they
press cancel, the entry form stays active with the changes still
entered.

So, if I'm on the entry form and have entered data, and then click on
the menu, the deactivate event fires and I get the correct prompt. If
I press cancel, I stay on the entry form. But if I click AGAIN on the
menu form, I've confirmed that the deactivate event doesn't fire so
the menu form becomes active without prompting the user. If I then
click back to the entry form and do it all over, the deactivate event
DOES run and the prompt is issued. So, the deactivate event is firing
every OTHER time I click on the menu form.

I notice that on the times that the deactivate event DOES fire, and I
select cancel and return to the entry screen, the activate event for
the entry screen fires, and then the activate event for the menu
screen fires after that even though the entry screen is the one which
will have focus. I suspect this is related.

Thanks in advance for any help on this question.

-Maxine

--
mg at pcg dot net


Nov 12 '05 #3

P: n/a
TC
You are right that BeforeUpdate will not fire if you simply click off the
form.

Could you make the form Modal? Then, he can not click off the form *at all*.
Once he is in it, he must close it before he can click on to anything else.
And at that point, if there is an unsaved record, BeforeUpdate will fire
then.

Can you say a bit more about why you do not want them to click off the form
with unsaved changes?

HTH,
TC
"Maxine G" <mg@nospam.com> wrote in message
news:Xn***************************@64.164.98.50...
Thanks. I've used deactivate in other settings for this (such as VB). I
don't think the BeforeUpdate event will fire if you simply click off the
form. And that's what we're trying to do - prevent the user from leaving
the form without explicitly saving or canceling changes.

-Maxine
mg at pcg dot net

"TC" <a@b.c.d> wrote in news:1063705972.19288@teuthos:
Deactivate() is not a common event from which to ask the user to save
changes.

Perhaps use the form's BeforeUpdate event? That will fire when the
form is actually about to save a new or edited record. If you cancel
that event, the new or updated data is not saved, but remains in the
form. If you Me.Undo, the new or updated data is discarded & the form
goes back to "square one".

HTH,
TC
"Maxine G" <mg@nospam.com> wrote in message
news:Xn***************************@64.164.98.50...
I have two forms, a menu and a data entry form. The entry form is
bound to a query against linked SQL server tables. In the deactivate
event, I have some code which asks the user if they want to save
their changes and they can respond with yes, no or cancel. If they
press cancel, the entry form stays active with the changes still
entered.

So, if I'm on the entry form and have entered data, and then click on
the menu, the deactivate event fires and I get the correct prompt. If
I press cancel, I stay on the entry form. But if I click AGAIN on the
menu form, I've confirmed that the deactivate event doesn't fire so
the menu form becomes active without prompting the user. If I then
click back to the entry form and do it all over, the deactivate event
DOES run and the prompt is issued. So, the deactivate event is firing
every OTHER time I click on the menu form.

I notice that on the times that the deactivate event DOES fire, and I
select cancel and return to the entry screen, the activate event for
the entry screen fires, and then the activate event for the menu
screen fires after that even though the entry screen is the one which
will have focus. I suspect this is related.

Thanks in advance for any help on this question.

-Maxine

--
mg at pcg dot net



Nov 12 '05 #4

P: n/a
Modal's a possibility, except that the form will be used for viewing
existing data as well, and I don't want the user to have to close the
form when just viewing a form. Can you change the disposition of a form
on the fly, for instance make it modal after they've entered data?

To me it just makes sense that the user should have to complete changes
on one form before leaving the form, either by closing it or clicking on
another form. If the user starts entering data on another, related form
and assumes that the changes from the first form were saved, then there
could be integrity issues.

But if it can't be done, it's not the end of the world. It just seems
like I should be able to count on the deactivate event firing EVERY time
I click off a form.

Thanks,
Maxine

"TC" <a@b.c.d> wrote in news:1063776382.641806@teuthos:
You are right that BeforeUpdate will not fire if you simply click off
the form.

Could you make the form Modal? Then, he can not click off the form *at
all*. Once he is in it, he must close it before he can click on to
anything else. And at that point, if there is an unsaved record,
BeforeUpdate will fire then.

Can you say a bit more about why you do not want them to click off the
form with unsaved changes?

HTH,
TC
"Maxine G" <mg@nospam.com> wrote in message
news:Xn***************************@64.164.98.50...
Thanks. I've used deactivate in other settings for this (such as VB).
I don't think the BeforeUpdate event will fire if you simply click
off the form. And that's what we're trying to do - prevent the user
from leaving the form without explicitly saving or canceling changes.

-Maxine
mg at pcg dot net

"TC" <a@b.c.d> wrote in news:1063705972.19288@teuthos:
> Deactivate() is not a common event from which to ask the user to
> save changes.
>
> Perhaps use the form's BeforeUpdate event? That will fire when the
> form is actually about to save a new or edited record. If you
> cancel that event, the new or updated data is not saved, but
> remains in the form. If you Me.Undo, the new or updated data is
> discarded & the form goes back to "square one".
>
> HTH,
> TC
>
>
> "Maxine G" <mg@nospam.com> wrote in message
> news:Xn***************************@64.164.98.50...
>> I have two forms, a menu and a data entry form. The entry form is
>> bound to a query against linked SQL server tables. In the
>> deactivate event, I have some code which asks the user if they
>> want to save their changes and they can respond with yes, no or
>> cancel. If they press cancel, the entry form stays active with the
>> changes still entered.
>>
>> So, if I'm on the entry form and have entered data, and then click
>> on the menu, the deactivate event fires and I get the correct
>> prompt. If I press cancel, I stay on the entry form. But if I
>> click AGAIN on the menu form, I've confirmed that the deactivate
>> event doesn't fire so the menu form becomes active without
>> prompting the user. If I then click back to the entry form and do
>> it all over, the deactivate event DOES run and the prompt is
>> issued. So, the deactivate event is firing every OTHER time I
>> click on the menu form.
>>
>> I notice that on the times that the deactivate event DOES fire,
>> and I select cancel and return to the entry screen, the activate
>> event for the entry screen fires, and then the activate event for
>> the menu screen fires after that even though the entry screen is
>> the one which will have focus. I suspect this is related.
>>
>> Thanks in advance for any help on this question.
>>
>> -Maxine
>>
>> --
>> mg at pcg dot net
>
>
>




--
mg at pcg dot net
Nov 12 '05 #5

P: n/a
TC

Maxine G <mg@nospam.com> wrote in message
news:Xn***************************@64.164.98.51...
Modal's a possibility, except that the form will be used for viewing
existing data as well, and I don't want the user to have to close the
form when just viewing a form.
Yes, that makes sense.
Can you change the disposition of a form
on the fly, for instance make it modal after they've entered data?
I don't believe so.

To me it just makes sense that the user should have to complete changes
on one form before leaving the form, either by closing it or clicking on
another form. If the user starts entering data on another, related form
and assumes that the changes from the first form were saved, then there
could be integrity issues.
I hear what you say. But to avoid that, I think most access developers would
go the modal form way.

But if it can't be done, it's not the end of the world. It just seems
like I should be able to count on the deactivate event firing EVERY time
I click off a form.
I've tried using deactivate for other things & never quite understood when
it fired & did not fire. I eventually gave up on it.

Cheers,
TC

Thanks,
Maxine

"TC" <a@b.c.d> wrote in news:1063776382.641806@teuthos:
You are right that BeforeUpdate will not fire if you simply click off
the form.

Could you make the form Modal? Then, he can not click off the form *at
all*. Once he is in it, he must close it before he can click on to
anything else. And at that point, if there is an unsaved record,
BeforeUpdate will fire then.

Can you say a bit more about why you do not want them to click off the
form with unsaved changes?

HTH,
TC
"Maxine G" <mg@nospam.com> wrote in message
news:Xn***************************@64.164.98.50...
Thanks. I've used deactivate in other settings for this (such as VB).
I don't think the BeforeUpdate event will fire if you simply click
off the form. And that's what we're trying to do - prevent the user
from leaving the form without explicitly saving or canceling changes.

-Maxine
mg at pcg dot net

"TC" <a@b.c.d> wrote in news:1063705972.19288@teuthos:

> Deactivate() is not a common event from which to ask the user to
> save changes.
>
> Perhaps use the form's BeforeUpdate event? That will fire when the
> form is actually about to save a new or edited record. If you
> cancel that event, the new or updated data is not saved, but
> remains in the form. If you Me.Undo, the new or updated data is
> discarded & the form goes back to "square one".
>
> HTH,
> TC
>
>
> "Maxine G" <mg@nospam.com> wrote in message
> news:Xn***************************@64.164.98.50...
>> I have two forms, a menu and a data entry form. The entry form is
>> bound to a query against linked SQL server tables. In the
>> deactivate event, I have some code which asks the user if they
>> want to save their changes and they can respond with yes, no or
>> cancel. If they press cancel, the entry form stays active with the
>> changes still entered.
>>
>> So, if I'm on the entry form and have entered data, and then click
>> on the menu, the deactivate event fires and I get the correct
>> prompt. If I press cancel, I stay on the entry form. But if I
>> click AGAIN on the menu form, I've confirmed that the deactivate
>> event doesn't fire so the menu form becomes active without
>> prompting the user. If I then click back to the entry form and do
>> it all over, the deactivate event DOES run and the prompt is
>> issued. So, the deactivate event is firing every OTHER time I
>> click on the menu form.
>>
>> I notice that on the times that the deactivate event DOES fire,
>> and I select cancel and return to the entry screen, the activate
>> event for the entry screen fires, and then the activate event for
>> the menu screen fires after that even though the entry screen is
>> the one which will have focus. I suspect this is related.
>>
>> Thanks in advance for any help on this question.
>>
>> -Maxine
>>
>> --
>> mg at pcg dot net
>
>
>



--
mg at pcg dot net

Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.