Microsoft KB Archive/88131

{|
 * width="100%"|

INF: OnCurrent Is Not Triggered on Unbound Forms
'Article ID: Q88131

Creation Date: 18-AUG-1992

Revision Date: 19-SEP-1996' The information in this article applies to:


 * Microsoft Access version 1.0

SUMMARY

If a form is unbound, macros or modules bound to the form's OnCurrent property will not run. In order to modify properties that can be changed at run time, the macro or module must be bound to either the OnOpen property of the form or the OnEnter property of the first control in the tab order of the form.

MORE INFORMATION

You can use the OnOpen property to trigger a macro or module each time a form is opened. Changes made to properties such as Visible will occur before the form is displayed. This allows you to make changes that your application's users do not see.

If, however, you want users to see the changes taking place, the macro must be run after the OnOpen property.

The following example creates a simple form with two text boxes. The macro that is triggered automatically sets the Visible property of the text box to Yes and No alternately so that it appears to flash several times when the form is opened. Note that you cannot change the Visible property of a control that is currently selected, so there must be at least one other object on your form to select:

 Create a new, unbound form.  Add a text box to the form, and give the text box the following properties: ControlName: Text0 ControlSource: Hello World   Add a second text box to the form, and give it the following property: "Control name: Text2" Save the form as Flash. Create a new macro, and then choose Macro Names from the View menu.  Add the following macro names and actions, and then save the macro group as Flashing Macros: Macro Name  Action --     Repeat It    GoToControl RunMacro Flash       SetValue RepaintObject SetValue RepaintObject Repeat It Actions ---     GoToControl Control Name: Text2 RunMacro MacroName: Flashing Macros.Flash Repeat Count: 10 Flash Actions --     SetValue Item: Forms![Flash]![Text0].Visible Expression: No     RepaintObject Object Type: Form Object Name: Flash SetValue Item: Forms![Flash]![Text0].Visible Expression: Yes RepaintObject Object Type: Form Object Name: Flash   View the Flash form in Design view. Set the form's OnOpen property to "Flashing Macros.Repeat It" Save and then close the form. Open the form in Form view.</li></ol>
 * }

-

"THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY." '' ©1997 Microsoft Corporation. All rights reserved. Legal Notices.

''

Additional reference words: 1.00

KBCategory: kbusage

KBSubcategory: FmsEvnt