Link to home
Start Free TrialLog in
Avatar of xenium
xenium

asked on

Detect if tab has focus

Hi,

how can i detect if a tab (or any other object) has the focus?

I can set the focus like this : Forms![Main]![&Fields].SetFocus
but instead i want to detect if it has the focus.

Thanks



Avatar of slamhound
slamhound

Have you considered storing a valiable on the click event of the tabs?
To find which control has focus use: Forms!FormName.ActiveControl.Name

You can use then in a If:Then statement to check your tab.

Dim ActiveCTL as Control
ActiveCTL = Forms!FormName.ActiveControl.Name

If YourControl = ActiveCTL then
     ' Do something if True
Else
     ' Do something if False
End If

I'll have to check this out tomorrow morning as I typing on the fly (dangerous for me), but think I'm in the BallPark...

Imoutwest
ASKER CERTIFIED SOLUTION
Avatar of Mike Eghtebas
Mike Eghtebas
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of xenium

ASKER

Thanks, yes that's what i needed!