Link to home
Start Free TrialLog in
Avatar of Mach1pro
Mach1pro

asked on

How to go to a specific TabIndexed control

I know the name of the control in a form  and can retrieve the tabIndex.  eg.  i = Controls("name of control").TabIndex
How can I set the focus to a specific control using the tabindex? For example I want to set focus to  i + 3
Avatar of tbsgadi
tbsgadi
Flag of Israel image

Hi Mach1pro,
How about Controls(i+3).setfocus

Good Luck!

Gary
Avatar of Mach1pro
Mach1pro

ASKER

tbsgadi
Your code would set the focus to the next control in the control indexes, not the next tabIndex.
ASKER CERTIFIED SOLUTION
Avatar of flavo
flavo
Flag of Australia 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 Leigh Purvis
You might want to check for TabStop being set to true also and count on only if that is met.

That would involve iterating through the controls at least three times!

But if you're sure it won't be then yep - Dave's way is the way.