I'm looking for a MS-Access form event which can check if the active control on the form has changed to another control; when it does a small script runs.
The function must be one which runs only when the form is active (such as a click on the form, etc). However, Form_Click() doesn't work as it somehow is not the same window.. I don't know what's going on there. Form_Click() also only works if you click form pieces, not controls (such as the Record Selector). This method should work for all controls with one method, not one method per control.
my code:
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 a way to do this? I can't use timers as if the user navigates away from the form, the Me.ActiveControl is no longer in the window and throws an error. Or, if anybody knows a way to check:
If (Me.Form IS IN ACTIVE WINDOW) Then ....