ACC97: Previous/ActiveControl Name Property Not in Auto ListID: Q175216
|
Moderate: Requires basic macro, coding, and interoperability skills.
You can use the ActiveControl property together with the Screen object to
identify or refer to the control that has the focus. However, if you type
Screen.ActiveControl or Screen.PreviousControl in a module or the Debug
window to view the properties that you can apply from the Auto List Members
list, the Name property does not appear on the list.
To refer to the Name property of the Screen.ActiveControl or
Screen.PreviousControl, you should create a variable and assign the
name of the control to that variable. For example, the following sample
piece of code is one way you could refer to the active control's name:
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Screen.ActiveControl
If ctlCurrentControl.Name = "txtCustomerID" Then
' Do this.
ElseIf ctlCurrentControl.Name = "btnCustomerDetails" Then
' Do this.
End If
Dim CControl as Control
Set CControl = Screen.ActiveControl.
For more information about using the ActiveControl object, search the Help Index for "ActiveControl property," or ask the Office Assistant.
Additional query words: screen
Keywords : PgmObj
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: April 30, 1999