ACC2000: Cannot Close Form from Control's OnExit PropertyID: Q210376
|
When you try to close a form from one of the following
the OnExit, OnEnter, OnLostFocus, or OnGotFocus property of a control on the formyou may receive the following error message:
-or-
the OnCurrent property of the form
This action can't be run while processing a form or report event.
A macro or procedure that closes the active form is called from a control's OnExit, OnEnter, OnLostFocus, or OnGotFocus property.
To work around this problem, add a new control that contains a flag to the form. Then, refer to that flag's value before closing the form. The following example demonstrates how to do this.
Me![FlagControl]=-1
To create this event procedure, click the OnExit property field,
click the Build (...) button to the right of the field, and then select Code Builder. After you enter the code, close the module.
If Me![FlagControl] Then
DoCmd.Close
End If
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.
DoCmd.Close
Additional query words: prb
Keywords : kberrmsg kbprg kbdta FmsEvnt
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: May 13, 1999