A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Where is the next control identified?



 
 
Thread Tools Display Modes
  #1  
Old November 11th, 2009, 04:48 AM posted to microsoft.public.access.forms
Chuck
external usenet poster
 
Posts: 372
Default Where is the next control identified?

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.
  #2  
Old November 11th, 2009, 05:13 AM posted to microsoft.public.access.forms
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default Where is the next control identified?

On Tue, 10 Nov 2009 20:48:07 -0800, Chuck
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.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:51 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.