Microsoft KB Archive/90142

= ACC: Toggle Button with BeforeUpdate Set to CancelEvent =

Article ID: 90142

Article Last Modified on 1/18/2007

-

APPLIES TO


 * Microsoft Access 1.0 Standard Edition
 * Microsoft Access 1.1 Standard Edition
 * Microsoft Access 2.0 Standard Edition
 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q90142



Moderate: Requires basic macro, coding, and interoperability skills.



SYMPTOMS
On a form, a toggle button that has its BeforeUpdate property set to a

macro that carries out the CancelEvent action behaves differently than a text box that has the same BeforeUpdate property setting.



CAUSE
Text boxes have a state in which they hold a Dirty value that cannot be saved or validated. This is why you can click a text box and, without making a change, move to another control.

Toggle buttons do not have a static state holding a Dirty value that cannot be validated. When the CancelEvent occurs, the button is left in its original, raised state. The button code does not consider the button to be dirty after the save failed. It has the original clean value.



STATUS
This behavior is by design.



Steps to Reproduce Behavior
The method outlined below uses the sample database Northwind.mdb (or NWIND.MDB versions 1.x or 2.0)

 Create a new form in Design view called ToggleTest based on the Products Table.  Add a toggle button to the form and set the following properties:

     Toggle Button: ControlName: Discontinued ControlSource: Discontinued Before Update: CancelEvent Test   Add a text box to the form set the following properties:

     Text Box: ControlName: ProductName ControlSource: ProductName (or Product Name in versions 1.x and                                    2.0) Before Update: CancelEvent Test   Create a new macro called CancelEvent Test with the following action:

<pre class="fixed_text">     Macro Name            Action CancelEvent Test     CancelEvent </li> View the ToggleTest form in Form view. Click the toggle button, and then press TAB to move to the next control. Note that the record is dirtied and the toggle button does not appear sunken.</li> Move to another record. Click in the text box, and then press TAB to move to another control. Note that the record is not dirtied.</li></ol>

Keywords: kbprb kbusage KB90142

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.