I am looking for an MS-Access form event that can check if the active control in the form has been changed to another control; when he runs a small run script.
The function should be the one that runs only when the form is active (for example, clicking on the form, etc.). However, Form_Click () does not work, because it is somehow not the same window. I don’t know what is going on there. Form_Click () also only works if you click the curly parts, and not the controls (such as the record selector). This method should work for all controls with one method, not one method for each control.
my code is:
Private Sub <<Form_ActiveHasChanged()>>
desc = Forms(Me.Form.Name).Controls(Me.ActiveControl.Name).StatusBarText
Me.txtInfo.Caption = desc
End Sub
where <<Form_ActiveHasChanged()>>is my event .. is there any way to do this? I can not use timers, as if the user was moving from the form, Me.ActiveControl is no longer in the window and throws an error. Or, if anyone knows a way to check:
If (Me.Form IS IN ACTIVE WINDOW) Then ....
source
share