473,383 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

deactivate event fires every OTHER time

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
5 3760
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: JayDee | last post by:
After a user enters data into a field, I need to populate other controls on the form, based on the user entry. I have to use either Leave, Validating or Validated, and I take it I can't use...
0
by: Robert Harty | last post by:
Hello all, I have a strange problem with a HtmlTable control, which is dynamically created based on the results of a query. Each row in the table has a LinkButton added to it. When I create...
19
by: Heidi Hundåla | last post by:
Hi ! I have a Wep App in C#. Page_Unload fires after Page_Load, and it seems totally unreasonable when you want to use this event when you _leave_ the page. In my project we wanted to use...
2
by: Breeto | last post by:
Can anyone please tell me why the following doesn't work... using System; using System.Web; namespace AspTests {
4
by: Bill Manring | last post by:
I need to capture the event when the user closes the browser in my application. I have some code in the session_End event, which works fine when the session times out, but I need to end the...
0
by: Rolf Barbakken | last post by:
I have a most annoying problem: I have a gridview with users from AD. When the user clicks on the header row a postback is triggered, and the _Sorting-event fires. This is fine, and my...
6
by: Joseph Geretz | last post by:
I'm porting a C# Outlook Addin originally engineered as a COM Addin over to use VSTO. I've gotten this to the point where my VSTO Addin installs its Menu items and Toolbar buttons when Outlook...
0
by: James | last post by:
Hi Something strange is happening... When the first page of my application loads, if I press a button (on the form) without filling in any fields on the form, the event the button usually fires...
3
by: Techsatish | last post by:
how to make a mouseup event called only once during a double click event? here double click is made on a tree node in a tree control. I have the code inside mouseup event....in runtime the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.