ActiveControl Property Example
The following example assigns the active control to the ctlCurrentControl
variable and then takes different actions depending on the value of the control's Name property.
Dim ctlCurrentControl As Control
Set ctlCurrentControl = Screen.ActiveControl
If ctlCurrentControl.Name = "txtCustomerID" Then
. ' Do this.
.
.
ElseIf ctlCurrentControl.Name = "btnCustomerDetails" Then
. ' Do this.
.
.
End If