473,408 Members | 2,832 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,408 software developers and data experts.

Why doesn't A97 cancel the click event?

MLH
I tried the following code to prevent a checkbox from being
updated (going from a value of Null to True, from True to
False or from False to True). I was surprised it did not work.

Can anyone offer a sensible, logical, insightful reason as to
why Microsoft does not want to let programmers stop this
event?

Private Sub NoOwnerInfoChkBox_Click()
If CurrentVehicleJobID = 0 Then
DoCmd.CancelEvent
DoCmd.GoToControl "CanclBtn"
End If

End Sub

Nov 13 '05 #1
7 2497
On Sun, 14 Aug 2005 14:05:20 -0400, MLH wrote:
I tried the following code to prevent a checkbox from being
updated (going from a value of Null to True, from True to
False or from False to True). I was surprised it did not work.

Can anyone offer a sensible, logical, insightful reason as to
why Microsoft does not want to let programmers stop this
event?

Private Sub NoOwnerInfoChkBox_Click()
If CurrentVehicleJobID = 0 Then
DoCmd.CancelEvent
DoCmd.GoToControl "CanclBtn"
End If

End Sub


Wrong event.
Code the Check Box BeforeUpdate event:

If CurrentVehicleJobID = 0 Then
Cancel = true
End If

You will be returned to the [NoOwnerInfoChkBox] control.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #2
MLH wrote:
Can anyone offer a sensible, logical, insightful reason as to
why Microsoft does not want to let programmers stop this
event?


Oh for the love of god, stop whinging and constantly complaining. It's
an outward sign of an inward inability to cope. And the funny part of
it is you're whinging constantly about probably the most robust of the
Access family, Access 97.

Use the f**king help file rather than constantly posting and then
answering your own posts - it's probably the best help file of any
system I've ever seen.

I work with many different trades and the old adage is true: It's a poor
craftsman who blames his failures on his tools.

The other expression which I learned maintaining and commanding armoured
fighting vehicles in the army: use the correct tool for the right job.

You seem to be continually falling into the wrong pit for both these
expressions.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Nov 13 '05 #3
MLH
Know about that one. Have used it for a decade. Do you
know why CancelEvent will cancel the update event but
not the click event? Usually, event properties that don't
appliy to an event are not listed in the event properties
window. This one, however, is - but it seems to have no
effect.

Wrong event.
Code the Check Box BeforeUpdate event:

If CurrentVehicleJobID = 0 Then
Cancel = true
End If

You will be returned to the [NoOwnerInfoChkBox] control.


Nov 13 '05 #4
"MLH" wrote
. . . Do you know why CancelEvent
will cancel the update event but
not the click event?


No, it would only be speculation: but perhaps they thought there was no
"associated action" to cancel... if you want to leave without executing the
VBA code, it is easy to structure your VBA code to do so. On the other hand,
cancelling Before Update cancels not the BeforeUpdate event (it has already
fired) but the actual data update.

In my use of BeforeUpdate and Cancel, I have always set the Cancel argument
to True before exiting, not used .CancelEvent as you did. And, there is no
Cancel argument on the Click event.

Larry Linson
Microsoft Access MVP
Nov 13 '05 #5
MLH
Thx for input, Larry. What confused me on this was my understanding
that CancelEvent cancelled not only the event ordered to be cancelled,
but the entire chain of ensuing events. EG, there cannot be an
AfterUpdate event w/o an Update event which logically should not occur
if CancelEvent runs in the BeforeUpdate code. No error is returned
upon processing CancelEvent during the Click event code. So naturally,
one would assume that the Click event and all ensuing events was
cancelled. But that is not the case.

So, I thought there might be some logic behind the scenes that some
one in this group might know about. The "associated action" you
mention should be ALL ensuing events, at the very least.

No, it would only be speculation: but perhaps they thought there was no
"associated action" to cancel... if you want to leave without executing the
VBA code, it is easy to structure your VBA code to do so. On the other hand,
cancelling Before Update cancels not the BeforeUpdate event (it has already
fired) but the actual data update.

In my use of BeforeUpdate and Cancel, I have always set the Cancel argument
to True before exiting, not used .CancelEvent as you did. And, there is no
Cancel argument on the Click event.

Larry Linson
Microsoft Access MVP


Nov 13 '05 #6
Bri


Tim Marshall wrote:
I work with many different trades and the old adage is true: It's a poor
craftsman who blames his failures on his tools.


Heard an interesting variation on this just last week:

"Its not the arrow, its the Indian"

--
Bri

Nov 13 '05 #7
MLH <CR**@NorthState.net> wrote in
news:dp********************************@4ax.com:
Thx for input, Larry. What confused me on this was my
understanding that CancelEvent cancelled not only the event
ordered to be cancelled, but the entire chain of ensuing
events. EG, there cannot be an AfterUpdate event w/o an Update
event which logically should not occur if CancelEvent runs in
the BeforeUpdate code. No error is returned upon processing
CancelEvent during the Click event code. So naturally, one
would assume that the Click event and all ensuing events was
cancelled. But that is not the case.

The issue is that certain actions can be undone. Others cannot. You
cannot undo a mouse click. or tabbing into a field. You can undo
the event triggered by clicking on the checkbox, which is toggling
the state of the checkbox, the CancelEvent will only stop the code
from running, and undo any undoable changes.
--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andrés Giraldo | last post by:
Hi! I'm adding an asp button to a datagrid on the ItemDataBound event, when the user clicks on this button, I basically remove the button and create other 2 buttons... my problem is.. the 2 last...
2
by: lmeng | last post by:
Hi, I am new to this Forum. Thanks in advance for any kind help. In the following HTML code, when I change the value of one text field then click "Modify" button, if the validation fails a...
15
by: Steve | last post by:
I have a form with about 25 fields. In the BeforeUpdate event of the form, I have code that sets the default value of each field to its current value. For a new record, I can put the focus in any...
5
by: Verde | last post by:
I'm using a 3rd party component in an ASP.NET 1.1 Web application. The component has a .Click event that can be fired from the client, with an associated event procedure in the code-behind module....
3
by: Charles Law | last post by:
Under what circumstances would e.Cancel be set to True on entry to the Closing event of an MDI child form? I have found that this is why my application won't close properly. I can explicitly set...
1
by: dave | last post by:
I have a html table and mutliple rows. On each row i put an onclick event that opesn a modal window and prompts the user for some information. I want this modal window to show when the user...
3
by: Gallarpri | last post by:
Hi, I'm making a dialog form with a textbox and 2 buttons: OK and Cancel. I want when I click on OK button, the program check the textbox, and if there is any error in the text introduced there,...
2
by: =?Utf-8?B?UmljaA==?= | last post by:
Is there a cancel argument for cancelling if you want to check or uncheck a checkbox? In the checkChanged event of a checkbox I ask the user if they are sure they want to check/uncheck...
3
by: nareshreddy | last post by:
Hi i am using the below code to close the window and i l get promt when click on 'X' button on ie browser with OK and Cancel buttons. if i click ok window will be closed, if i click cancel window...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.