On Tue, 10 Nov 2009 20:48:07 -0800, Chuck
<Chuck@discussions.microsoft.com> wrote:
A simple solution would be to iterate over the Controls collection,
checking the TabIndex property:
dim ctl as control
for each ctl in me.controls
if ctl.TabIndex = Me.myControl.TabIndex + 1 then Msgbox "The next
control is " & ctl.Name
next
(of course you replace myObjectNames with yours)
Oh, but what if I used the mouse to move focus 3 controls ahead?
Your requirement is VERY curious. I think you are saying that when I
tab out of a control, you want OnLostFocus set focus somewhere else,
then set it to where I wanted to go in the first place. What's the
point of this side-step? Which would probably only last milliseconds?
Show us some code (stripped to the bare essentials) and we may be able
to suggest a better way.
-Tom.
Microsoft Access MVP
>Screen.PreviousControl.Name provides the name of the control that last had
>the focus. That's nice if you need to know where control came from, but
>there doesn't seem to be a Screen.NextControl.Name or anything similar.
>
>I have code that is executed OnLostFocus in which I would like to save the
>name of the control that will be receiving the focus. This would allow me to
>force the focus to some other control and then, after the required processing
>of that control has finished, restore the focus to the control indicated by
>the user.