ACC2000: Screen.ActiveForm Returns the Main Form, Not the Subform (210210)
The information in this article applies to:
This article was previously published under Q210210 Advanced: Requires expert coding, interoperability, and multiuser skills.
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).
SYMPTOMS
If the currently active control on the screen is in a subform,
Screen.ActiveControl correctly references this control.
Screen.ActiveForm, however, references the main form and not the
subform that the control is contained on.
CAUSE
A subform is not really a form, but a control (just like a text box or
command button) that appears on a form. Screen.ActiveForm always returns the active form, not a subform control.
RESOLUTION
You can use the Set_Screen_ActiveSubformControl function described in the "More Information" section to determine what subform control contains the Screen.ActiveControl. This function sets a global control variable Screen_ActiveSubformControl to the currently active subform control on screen. The Set_Screen_ActiveSubformControl() function returns one of the following results:
True: Screen_ActiveSubformControl was set to the subform control
that contains Screen.ActiveControl.
-or-
False: Screen.ActiveControl does not exist or is not in a subform.
Modification Type: | Major | Last Reviewed: | 6/29/2004 |
---|
Keywords: | kbprb KB210210 |
---|
|